Re: date/Snow Leopard changed
Re: date/Snow Leopard changed
- Subject: Re: date/Snow Leopard changed
- From: "Nigel Garvey" <email@hidden>
- Date: Mon, 7 Sep 2009 11:00:48 +0100
Yvan KOENIG wrote on Sun, 6 Sep 2009 22:24:38 +0200:
>I use a handler which tell which is the in use format.
>
>my whichDateFormat()
>
>on whichDateFormat()
> try
> set d to "31/12/1943"
> date d
> return "dd/mm/yyyy"
> end try
>
> try
> set d to "1943/12/31"
> date d
> return "yyyy/mm/dd"
> end try
> try
> set d to "12/31/1943"
> date d
> return "mm/dd/yyyy"
> end try
>end whichDateFormat
Or perhaps some variant on this:
on whichDateFormat()
tell date ("1/2/3" as text)
set its time to 14 * hours
set {year:y, month:m, day:d, time string:ts} to it
end tell
tell {missing value, missing value, missing value}
set {item (y mod 10), item (m as integer), item d} to {"/yyyy", "/
mm", "/dd"}
return {text 2 thru -1 of beginning & item 2 & end, ¬
item (((ts begins with "14") as integer) + 1) of {" 12h", " 24h"}}
end tell
end whichDateFormat
whichDateFormat()
--> {"dd/mm/yyyy", " 24h"} (on my machine)
Obviously these only tells you about the running machine. There's no
sure-fire way to deduce the format being used in a received short-date string.
NG
_______________________________________________
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