JRS: In article <df327t0vpm@news3.newsguy.com>, dated Tue, 30 Aug 2005
21:47:48, seen in news:comp.lang.javascript, Jim Davis
<newsmonkey@vboston.com> posted :
>"Dr John Stockton" <jrs@merlyn.demon.co.uk> wrote in message
>news:+nnDl3BhTOFDFwaN@merlyn.demon.co.uk...
>> JRS: In article <df1vn6026dh@news2.newsguy.com>, dated Tue, 30 Aug 2005
>> 11:58:36, seen in news:comp.lang.javascript, Jim Davis
>> <newsmonkey@vboston.com> posted :
>>>I'm (still) working on an ISO 8601 date parser.
>>
>> Please do not start a new thread to continue an existing discussion. As
>Honestly it seems like you're being rather pendantic about this (or in
>general I don't you so perhaps it's that).
Please read what you write before expecting others to do so. You can
then adjust it to be potentially comprehensible.
>>>So... that's the current time there... but my spec is that timezone
>>>information, if present, should be used to convert the given time to local
>>>time. For me, for example, this would be -5:00 from GMT.
That seems strange. A datum such as 1111-11-11 22:22:22 is in local
time, but there remains the question of which locality. The processer's
local offset is not necessarily the offset at the location of the data.
Timezone information enables conversion to UTC. Conversion to own local
is a further, albeit trivial in javascript, step.
>> Remember that you should not use new Date(Y, M, D, h, m, s, ms) as
>> that muddles the situation with your local zone. Use new
>> Date(Date.UTC(,,,,,,)) .
>
>Well... only if I want UTC time. ;^)
No; if the computer's timezone is not the data's timezone. First
determine the meaning of the data, then consider the presentation.
>My spec is clear that, if timezone information provided, it should be used
>to convert the time to local time.
If that's so, you go beyond ISO 8601.
>> Read the FAQ; see below. Use extant resources before reinventing
>> wheels.
>
>Perhaps I'm missing it. I see nothing in the FAQ that concerns this. A
>rather extensive search didn't produce the answer I needed.
>
>I'm neither too proud or too stupid to existing code when I can find it and
>when it's appropriately licensed.
As above.
>> Consider
>> new Date(Date.UTC(Y, M, D, h+oh, m+om, s, c))
>> where oh, om are the offsets and maybe + should be - ; that's not
>> explicit in the cited resource but should be obvious after reading it.
>
>That does not convert a date... it provides the UTC date.
"Consider" is a recommendation that you read and think about it. It
does not mean that you can use it directly. That statement in fact
gives a Date Object which holds the instant given by the arguments
interpreted as UTC, but default conversion to string uses your local
timezone.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Received on Tue Oct 18 03:15:33 2005