• 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
Arcane date smarts (Was: Getting a folder based on creation date)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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"


  • Follow-Ups:
    • Re: Arcane date smarts
      • From: Jon Pugh <email@hidden>
  • Prev by Date: ANNOUNCE: Image Info 0.9 Beta
  • Next by Date: Re: Does "rounding" work in OS 9.2.1
  • Previous by thread: ANNOUNCE: Image Info 0.9 Beta
  • Next by thread: Re: Arcane date smarts
  • Index(es):
    • Date
    • Thread