On Sep 5, 2009, at 4:53 PM, Robert Poland wrote: The problem isn't with "short date string", but that "9/9" isn't a valid input for a date.
--> error "Invalid date and time date 9/9 of «script»." number -30720
You have to provide month, day, and year, in one of the formats specified in the Language & Text System Preferences.
Ok Michelle, Here's the portion of the script I have been using for ages. It would accept either 9/9, 9/9/09.
That changed with Snow Leopard, and has been a topic of discussion on this list for the past week. Here is the relevant portion of the release notes:
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.
-- Michelle
-- Science is the defense of ignorance, the insistence that we do not know what we do not know. --Clifford Geertz
|