Re: Representable date range: experiment results
Re: Representable date range: experiment results
- Subject: Re: Representable date range: experiment results
- From: "Nigel Garvey" <email@hidden>
- Date: Thu, 20 Oct 2005 21:02:35 +0100
"Mark J. Reed" wrote on Thu, 20 Oct 2005 11:53:07 -0400:
>Mr. Neuburg's book states that the range of reprecentable years seems to be
>100-9999, but I had no problems on Panther or Tiger with years before 100,
>all the way down to 1 AD/CE:
>
>$ osascript -e 'tell current date to set {year, d} to {1, it}
>date string of d'
>Saturday, October 20, 0001
The official AppleScript date range -- within which it's possible to
_compile_ a date -- is from 1st January 1000 00:00:00 to 31st December
9999 23:59:59. It's possible to _calculate_ beyond that range, but that's
basically just to give headroom for calculations, not to be used for its
own sake. AppleScript dates use the Gregorian calendar.
>Interestingly, if you try to set year 0, you get the right weekday for 0 CE
>(1 BCE), but the year number still displays as 1:
In the Gregorian calendar, 0 is obviously a nonsense value for a year. As
are negatives. But it seems that AppleScript dates can go back quite a
long way.
set d to (date "Wednesday 1 January 1000 00:00:00")
d - (400 * 365 + 97) * 3 * days -- subtract 1200 years
--> date "Wednesday 1 January 0201 00:00:00"
... which is the right answer if you read the year as BC. It's not
displayed as such because you're only supposed to be able to go back as
far as 1000 AD.
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden