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

Rép: date/Snow Leopard changed


  • Subject: Rép: date/Snow Leopard changed
  • From: Yvan KOENIG <email@hidden>
  • Date: Thu, 3 Sep 2009 11:36:45 +0200

Le 2 sept. 2009 à 23:31:05, Christopher Nebel a écrit :

So, I thought that date "6:01" of (current date) was wrong.

It's not. Good news.

Right, that's an old feature called relative dates -- you can specify a time "of" another date object.  The time string still has to match the system formatting, of course.  A "date" string may contain a date only, time only, or a date and a time.

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.

"Date" strings with only a date or only a time follow the same rules as before: with no time, the time is presumed to be midnight; with no date, the date is presumed to be the current date.  Therefore, 'date "6:01"' and 'date "6:01" of (current date)' are equivalent.

The reason 'date "6:01"' worked for Yvan and not Michelle is that she's using the US locale, which uses a 12-hour clock, and therefore the "AM" or "PM" is required.  Yvan, however, is using French, which uses a 24-hour clock, so the AM/PM is optional.

Date input is actually somewhat more lenient than the release notes say it is -- there were some changes that made it in shortly before release.  For example, the official US format uses a comma between the month-day and the year (e.g., "Sep 2, 2009"), but it will still accept a date string without a comma.  In general, though, you should try to match the system format as closely as possible.

One other thing to watch out for is that CFDateFormatter uses different heuristics for interpreting two-digit years, so AppleScript now uses a cut-off of 1950 (that is, "50" is 1950, "49" is 2049), where the older API used a cut-off of 1991.


--Chris Nebel
AppleScript Engineering



Thanks for this precisions.

Alas, there is always a huge problem.

I receive (and I'm not the only one) files embedding dates but,
some built in France use the dd/mm/yyyy format
some built in English speaking area use the mm/dd/yyyy format
Other use the international yyyy/mm/dd format.

As AppleScript is linked to the system settings, I am force to decipher these dates using the good pl TID scheme.

Isn't it a way to get a tool allowing us to convert dates with a clean tool as we have, in spreadsheets a function allowing us to convert numbers from one base to an other one?

something like 
localizeDate("12/31/1943","US") 
or 
localizeDate("1943/12/31","IEEE")

Yvan KOENIG (VALLAURIS, France) jeudi 3 septembre 2009 10:46:25



 _______________________________________________
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

  • Prev by Date: Re: get program name on start
  • Next by Date: Re: documentation for Snow Leopard Quicktime?
  • Previous by thread: Re: Rép: date/Snow Leopard changed
  • Next by thread: Re: Snow Arithmetic
  • Index(es):
    • Date
    • Thread