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:
Stephen Turner
Date:
October 26, 2004 06:33
Subject:
Re: [OT] Excel Golf: Unix Time to Excel Time in one line
Message ID:
Pine.LNX.4.58.0410261430290.3861@gentoo
On Tue, 26 Oct 2004, McGlinchy, Alistair wrote:
>
> Here's a horrid 297 Byte solution:
>
> =	DATE(1970,1,1)+ A2/24/60/60+1/24 *
> 	AND(
> 		DATE(YEAR(DATE(1970,1,1)+A2/24/60/60),5,1)
> 			-
> 		WEEKDAY(DATE(YEAR(DATE(1970,1,1)+A2/24/60/60),5,1),2)
> 			+
> 		1/24
> 	<
> 		DATE(1970,1,1)+A2/24/60/60
> 	,
> 		DATE(1970,1,1)+A2/24/60/60
> 	<
> 		DATE(YEAR(DATE(1970,1,1)+A2/24/60/60),11,1)
> 			-
> 		WEEKDAY(DATE(YEAR(DATE(1970,1,1)+A2/24/60/60),11,1),2)
> 			+
> 		1/24
> 	)
>
>

I don't know much about Excel, but I think DATE(1970,1,1) can be spelled
25569. If I'm right, that would save you at least 63 strokes.

-- 
Stephen Turner, Cambridge, UK    http://homepage.ntlworld.com/adelie/stephen/
  "Low Priced Cambridge Clare College. Big selection at eBay UK!"
  (Ad after Google search for Clare College Cambridge)

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