JRS: In article <
[email protected]>,
dated Wed, 8 Jun 2005 12:07:30, seen in
Michael Winter said:
As I see it, that wasn't the issue at all, which was why I said you
weren't answering the question. I don't think the OP understood that the
Date constructor created a local-time Date object, which was why
Date.prototype.getUTCFullYear wasn't returning the year used in the
constructor.
That could be deceptive wording. Date Objects are fundamentally UTC
(valueOf() gives UTC ms); my belief is that they probably know nothing
of the corresponding local time, but know how to ask the OS or browser
when they need the information.
The constructor constructs an object with a UTC ms value, using
parameters in Local Time.
The Object has methods for returning information both in UTC and in
Local Time.
Note that my tests show that the UTC functions are substantially faster
than the non-UTC ones; so where the work is using "calendar time"
rather than "clock time" it may be worth using the UTC functions.
I wonder - if one constructs a current Date Object in the UK, where it
is now Summer, then sets the computer to Casablanca (where there is no
Summer Time), Detroit (where time is delayed) or Sydney, then uses the
UTC and civil methods on the Object, what does one see? Does the object
use the setting at the time of interrogation, or at the time of its
creation, or what? - with due consideration of the time the computer
actually shows.
ISTM that would be an interesting and potentially useless piece of
knowledge.
UT is different from UTC. Read the article again.
Someone, IIRC, suggested that I might explain the exact difference
between time scales. I decline; but there are links on my site. Be
careful to trust only the sites of respected time-standards
organisations.
However, javascript does NOT use UTC, it only claims to. UTC has Leap
Seconds, and javascript does not.
The closest presently-defined time scale to the GMT of, say, AD 1950 is,
I've been told, UT. However, that looks like a typo for UTC.
I prefer to use, in javascript, the term GMT; except for special cases,
a small computer generally has a larger time error that the difference
between GMT ans any other "scientific" scale.
But be aware that GMT was different; before 1925, it started at the
following Noon (before mid-Oct 1805, RN time started the previous Noon).