Arcane date smarts (Was: Getting a folder based on creation date)
Arcane date smarts (Was: Getting a folder based on creation date)
- Subject: Arcane date smarts (Was: Getting a folder based on creation date)
- From: Richard Morton <email@hidden>
- Date: Thu, 1 Nov 2001 09:45:28 +1100
Nigel Garvey's message of 31/10/01 11:26 PM contained:
>
> set today to (date "12:00:00 AM") of (current date)
>
>
Wow! I've never seen anything like that. A date of another date!
I wondered if that would catch your attention Nigel. :-}
>
It works
>
in both OS 9.0.4 and OS 8.6...
And 9.1
>
... If the line contains two date specifications rather
>
than involving a function or a variable, it actually compiles as a
>
combined date:
>
>
date "17" of date "6:30"
>
--> Compiles (today) as: date "Wednesday, 17 October 2001 06:30:00"
>
>
Is this a bug or a feature?
I don't know, but I'd say the latter. As we've seen before, AS has some
very cool date smarts. All sorts of partial date strings evaluate in a,
usually, predictable way. I wonder who was responsible for that. Does
anybody know?
>
By the way, it's still about five times as fast to set midnight of the
>
current date in the conventional way:
>
>
set today to (current date)
>
set today's time to 0
Or if you want it really fast - without any call to 'current date':
set firstMoment to "12AM"
set today to date firstMoment
--> date "Thursday, 1 November 2001 12:00:00 AM"
Any less info than "12AM" and it takes the number as being the day.
Not entirely sure where that could save any appreciable time, but if it
will interest anyone, it will be someone here no doubt.
Cheers,
Richard Morton
-- Great Lies of the Music Business: "I really love the band"