Re: A few questions about dates
Re: A few questions about dates
- Subject: Re: A few questions about dates
- From: "Nigel Garvey" <email@hidden>
- Date: Wed, 30 Aug 2006 00:55:51 +0100
kai wrote on Tue, 29 Aug 2006 02:36:32 +0100:
>
>On 27 Aug 2006, at 21:56, Mark J. Reed wrote:
>
>> None of which addresses Sweth's question about what AppleScript does.
>
>The simplest way to convert a date to seconds is obviously to compare
>it with the aforementioned Mac epoch. But just for fun, the following
>is an attempt (albeit one that relies on a bit of a hack) to extract
>the seconds without such a comparison - by parsing the value of the
>date class's 64 bit integer:
Another method, which doesn't require a hack, is:
on date_as_seconds(d)
set fRef to (open for access file ((path to temporary items as
Unicode text) & "date.dat") with write permission)
try
set eof fRef to 0
write d to fRef
set s to (read fRef from 1 as double integer)
end try
close access fRef
return s
end date_as_seconds
date_as_seconds(current date)
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden