develooper Front page | perl.golf | Postings from October 2004

RE: [OT] Excel Golf: Unix Time to Excel Time in one line

Thread Previous | Thread Next
From:
Gerber, Christopher J
Date:
October 28, 2004 09:40
Subject:
RE: [OT] Excel Golf: Unix Time to Excel Time in one line
Message ID:
DAE79A519D0ECB4DA2E3864CDB61A4E7D31B54@groamrexm01.amer.pfizer.com
Alistair,

> > > >  86400/24 can be changed to 3600
> > Very nice!  My 86000/24 trick is still good, but I did a 
> horrible job 
> > of explaining it.  What I should have said is:
> > 
> >    X/86400+(Y)/24 = (X/3600+Y)/24
> 
> Not quite:
>      X/86400+(Y)/24 = (X/3600+(Y))/24
> 
> In our formula, Y contains low-precedence operator "<". 
> Removing the parens around Y causes the addition of X/3600 to 
> occur before the < which is not what we want.
>  
> Explicitly:
> 	25569+X/86400+(a<b)*Z/24
> Doesn't equal
> 	25569+(X/3600+a<b)*Z/24  (consider X very large or Z=0) 
> We need another set of parens to make it correct. 
> 	25569+(X/3600+(a<b)*Z)/24
> 
> One step forward two steps back, or <fingers crossed> am I 
> missing something? </fingers crossed>

Hmmm... now I have to go back and look!  (fingers crossed as well...)

Here's the formula that I last posted:
   = 25569+(A2/3600+
 	DATE(A2/316^3+14,5,)-WEEKDAY(DATE(A2/316^3+14,5,))+25/24
 		<
 	5115+A2/86400
   )*(
 	5115+A2/86400
 		<
 	DATE(A2/316^3+14,11,)-WEEKDAY(DATE(A2/316^3+14,11,))+25/24
   )/24

I really made a mess of it.  I moved the A2/3600 inside a parenthesis that
did not match with the last closing parenthesis.  My results are completely
off now.  That's one point for you! ;)  If it's any excuse, I live about 90
minutes from Boston and haven't been getting much sleep this week.  (Go
Sox!)

The Perl diehards must be pretty tired of us by now!

Chris


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About