JRS: In article <>, dated
Mon, 14 Aug 2006 01:20:53 remote, seen in news:comp.lang.javascript, Jim
Davis <> posted :
>"Dr John Stockton" <> wrote in message
>news
...
>> JRS: In article <>, dated
>> Sun, 13 Aug 2006 12:55:45 remote, seen in news:comp.lang.javascript, Jim
>> Davis <> posted :
>>>
>>>As far as adding to the current date (getting the future date)
>>>JavaScript's
>>>Date object is very rich. There are "set" and "get" methods for all data
>>>parts and several abstractions.
>>
>>
>> Actually, there is only one data part, an IEEE Double of milliseconds
>> from 1970.0 GMT. There are "get" methods for most derivable components
>> of conventional forms of the UTC/local date/time (but not Week Number,
>> although ISO 8601 defines it). For most of those, but not all, there is
>> a "set" method.
>
>Sorry - typo. I meant "date part".
>
>Although (since you got me thinking) "data part" is, I think, applicable -
>not physically as in the memory storage of the implementation but rather (as
>you imply) as information derivable from that implementation. It's
>applicable since I was talking about the interface to the Date object rather
>than the implementation.
> ...
There is a test, ISTM : The Date Object is required to behave as if it
stores just an IEEE Double of milliseconds from 1970.0 GMT, limit 10^8
days-worth; but it is neither required to store only that, not to store
exactly that.
Using only UTC functions, set a date from year, month, day and then read
out year, month, day in that order. We know that converting YMD to
milliseconds and milliseconds to YMD are tasks of similar complexity.
If setting YMD and reading Y take similar times but then reading M & D
is much faster, then there must be some sort of cache for M & D and
presumably Y; if each of the four take a similar time, then probably
only milliseconds are stored. That could be browser-dependent.
I've now put the code for function setDay in my js-date8.htm; also a
proposed method for setting the Week. Corresponding setUTC... functions
are then obvious. But function setTimezoneOffset is probably
impossible.
--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.