Oops I responded to has when thinking that I was responding here.
I was surprised but it works.
Parsing of date strings now uses CFDateFormatterCreateDateFromString, which means that custom
date formats, Unicode-only locales such as Arabic, and non-Gregorian calendars are now all handled correctly.
However, it is also much more restrictive about deviating from the system date format. Previous versions
would accept anything that looked even vaguely like a date: the string could omit components, reorder
others, add or omit punctuation, and so on. In AppleScript 2.1, the string must exactly match one of the
system date formats (full, long, medium, or short; see System Preferences > International > Formats for
examples), including all punctuation and whitespace. The only difference allowed is to use either a two- or
four-digit year, regardless of what the format uses.
Some scripts used partial date specifiers as a way to get dates relative to the current date, such as date
"1/31" for January 31 of the current year, or date "15" to get the 15th of the current month. To do this
in AppleScript 2.1, get a base date and then set the desired components using the properties of the date
object. For example, to get January 31 of the current year:
set d to date "1/31/2000"
set year of d to year of (current date)
d --> date "Saturday, January 31, 2009 12:00:00 AM"
Alternatively, start with current date as the base. To get the 15th of the current month:
set d to current date
set day of d to 15
set time of d to 0
d --> date "Friday, May 15, 2009 12:00:00 AM"
This technique works with all versions of AppleScript, and can be used for scripts that must run on 10.6 and
10.5 and earlier.
So, I thought that date "6:01" of (current date) was wrong.
It's not. Good news.
Looking closer, I discovered that the ref to (current date) is not required:
date "06:01"
gives the same result than
date "06:01" of (current date).
I wish to know Chris Nebel (or Chris Page) opinion about such a behavior.
Yvan KOENIG (VALLAURIS, France) mercredi 2 septembre 2009 20:28:44