Re: The latest AS date and AS Editor bugs
Re: The latest AS date and AS Editor bugs
- Subject: Re: The latest AS date and AS Editor bugs
- From: Nigel Garvey <email@hidden>
- Date: Wed, 12 Jun 2013 21:38:33 +0100
Shane Stanley wrote on Wed, 12 Jun 2013 09:17:13 +1000:
>set ASDate to current date
>set day of ASDate to 1
>set month of ASDate to 7
>set day of ASDate to 12
>set time of ASDate to 60 * 60 * 15
>-- make a date six months later
>set sixMonths to 184 * days
>set newASDate to ASDate + sixMonths
>log ASDate's hours
>log newASDate's hours
>{ASDate, newASDate}
>
>Here that gives:
>
>{date "Friday, 12 July 2013 15:00:00 +1000", date "Sunday, 12 January
2014
>15:00:00 +1100"}
>
>Seems to me that second one should be either "16:00:00 +1100" or
"15:00:00
>+1000".
The thing is, of course, that AS dates don't (yet) support time zones or
(as required for your argument) daylight saving times. Your script's
date mathematics are correct according to the long-standing spec, but
there's the anomaly that the system borrowed to format the date strings
to local preferences _does_ now include time zone. This is either
something which slipped past the AppleScript people responsible or they
were gambling that no-one would use dates earlier than December 1847 or
include the time zone in their medium date strings.
>> But of course I now use non-string methods to set them.
>
>For which a single command would save an awful lot of mucking around.
Yes indeed. But one-liners are possible:
tell (current date) to set {knownMonday, year, its month, day, time} to {it, 1000, 1, 6, 0}
-- Or:
set knownMonday to «data isot3130303030313036» as date
knownMonday
--> date "Monday 6 January 1000 00:00:00" (Up to and including Leopard.)
--> date "Monday 1 January 1000 00:00:00" (Snow Leopard. The date's the first according to Lion's 'date string' and 'short date string' too.)
--> date "Sunday 5 January 1000 23:58:45" (ML in Europe/London zone.)
-- But, correctly with all systems:
knownMonday's {weekday, day, month, year, time}
--> {Monday, 6, January, 1000, 0}
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