• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: A few questions about dates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: A few questions about dates
      • From: kai <email@hidden>
    • Re: A few questions about dates
      • From: Philip Aker <email@hidden>
  • Prev by Date: Re: (no subject)
  • Next by Date: Re: A few questions about dates
  • Previous by thread: Re: A few questions about dates
  • Next by thread: Re: A few questions about dates
  • Index(es):
    • Date
    • Thread