• 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
Re: Representable date range: experiment results
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Representable date range: experiment results
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: Days and hours
  • Next by Date: scripts bumping into other scripts
  • Previous by thread: Representable date range: experiment results
  • Next by thread: Re: Representable date range: experiment results
  • Index(es):
    • Date
    • Thread