Re: Representable date range: experiment results
Re: Representable date range: experiment results
- Subject: Re: Representable date range: experiment results
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 20 Oct 2005 16:45:23 -0400
On 10/20/05,
Nigel Garvey <
email@hidden> wrote:
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.
Thanks.
In the Gregorian calendar, 0 is obviously a nonsense value for a year. As are negatives.
Untrue, especially in the Gregorian calendar. Astronomers, to
pick an example, tend to use 0 and negative years CE, reckoned on the
Gregorian calendar, instead of switching to BCE.
The often-heard statement that "there was no year 0" is
misleading. There is indeed a year that can correctly be
identifed as 0 AD; it's just that it is the *same* year that is
conventionally identified as 1 BC. There was no year in between 1
BC and 1 AD; the day after December 31, 1 BC was January 1, 1 AD.
In practice, the importance of this fact is simply that you can't treat
BC as "negative AD" and have the math work; there's an extra one-year
offset introduced because on the number line, there *is* a number
between -1 and 1, namely 0. So 0 AD = 1 BC, and year (-n) AD =
year (n+1) BC. And, for that matter, 0 BC = 1 AD and year (-n) BC
= year (n+1) AD, so we're currently living in the year -2004 BC.
But I wouldn't go around writing that on your checks. :)
The important thing from an AS perspective is that it does the right
thing with an input of year 0 by treating it as 1 BC; the weekday of
dates that year confirms this.
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.
The unfortunate thing is that there's no way to *tell* that you should
read it as BC. I put in year 0, it comes back 1. I put in
year 1000 and subtract 1200, it comes back 201. That's wrong no
matter how you count. If I put in 0 and it stayed 0, or I put in
1000 and subtracted 1200 and it came back -200, that would be
better. Alternatively, if there were a property I could check
that would tell me whether the number returned by the year property was
BC or AD, that would be OK too. But as it stands, neither is
true, so the ability to represent dates prior to 1AD is academic at
best.
Thanks for the response.
--
Mark J. Reed <
email@hidden>
_______________________________________________
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