• 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: Revisited: date/Snow Leopard changed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Revisited: date/Snow Leopard changed


  • Subject: Re: Revisited: date/Snow Leopard changed
  • From: Michelle Steiner <email@hidden>
  • Date: Sat, 5 Sep 2009 17:16:30 -0700

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.

set y to "9/9"
date y

--> 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    


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >date/Snow Leopard changed (From: Robert Poland <email@hidden>)
 >Re: date/Snow Leopard changed (From: Yvan KOENIG <email@hidden>)
 >Re: date/Snow Leopard changed (From: Robert Poland <email@hidden>)
 >Revisited: date/Snow Leopard changed (From: Robert Poland <email@hidden>)
 >Re: Revisited: date/Snow Leopard changed (From: Michelle Steiner <email@hidden>)
 >Re: Revisited: date/Snow Leopard changed (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Revisited: date/Snow Leopard changed
  • Next by Date: Re: date/Snow Leopard changed
  • Previous by thread: Re: Revisited: date/Snow Leopard changed
  • Next by thread: Re: date/Snow Leopard changed
  • Index(es):
    • Date
    • Thread