new Date("2001/1/1 0:0:0R")

  • Thread starter Dr John Stockton
  • Start date
D

Dr John Stockton

Javascript date strings can have a one-letter postfix; it is taken as
indicating time zone (not J, which causes NaN).
// IIRC, VB accepts A & P in that location, for AM & PM.

In my MS IE 4, the object generated by new Date("2001/1/1 0:0:0R")
has value meaning Sun Dec 31 19:00:00 UTC 2000.

That combination of local time and UTC corresponds, AIUI, to Tashkent
and Karachi, in Asia (and not to any US towns of the same name).

RFC 0822 authorises that notation in news/mail headers, apparently with
that sense.

However, AIUI, the US military use letter postfixes for time zones, in
the inverse sense - R Romeo being Winter Time on the US East Coast (and
I think J being Local Time).

RFC 2822 says 0822 got it wrong, and therefore disallows the notation in
headers.

ECMA 262 seems not to define the contents of date strings.


What do other browsers show for new Date("2001/1/1 0:0:0R") ?


<URL:http://www.merlyn.demon.co.uk/misctime.htm#Zones>,
<URL:http://www.merlyn.demon.co.uk/js-date0.htm#TP>.
 
M

Michael Winter

On Mon, 4 Oct 2004 21:28:03 +0100, Dr John Stockton

[snip]
What do other browsers show for new Date("2001/1/1 0:0:0R") ?

Using: document.write(new Date("2001/1/1 0:0:0R"));

Opera 7.54: Mon, 01 Jan 2001 00:00:00 GMT+0000
IE 6.0.2900.2180: Sun Dec 31 19:00:00 UTC 2000
Gecko[1]: Invalid Date
NN4: Invalid Date

Mike


[1] All major Mozilla versions from 1.0 to 1.7, plus 1.7.3. Also includes
Firefox 0.9.3 and Netscape 7.2.
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Mon, 4 Oct 2004 22:34:32, seen in Andrew
Thompson said:
Date: Mon, 04 Oct 2004 22:34:32 GMT
X-Trace: news-server.bigpond.net.au 1096929272 203.51.78.166 (Tue, 05 Oct 2004
08:34:32 EST)

using this string in the address area..
javascript:new Date("2001/1/1 0:0:0R")

I got...
IE 6.0026 "Mon Jan 1 06:00:00 UTC+1100 2001"
Moz. 1.7.2 "Invalid Date"
Opera 6.54 "Mon, 01 Jan 2001 00:00:00 GMT+1100"
NN 4.78 "Invalid Date"

That was about 8:29am, Tue 5th Oct 2004, if that's relevant
(..actually it was about that time even if it's not relevant)

But I collected the article at about 07:45 on that date <G>.


R being a 5-hour offset of uncertain sign, it's a bit confusing with you
being +1100 and using an AU server on the verge of antipodean Summer.

I think your IE6 gets the same UTC as I do, Sun Dec 31 19:00:00 UTC 2000
I think Opera ignored the postfix R.

These postfixes seem wholly untrustworthy.

AFAICS, +1100 currently means EITHER located in Tasmania Summer (or some
tiny islands, or Siberia) ; OR that
<URL:http://www.merlyn.demon.co.uk/uksumtim.htm#Else> is wrong. ??.
Your server seems to be in East Coast winter still, EST being 10 hours
ahead of GMT.
 
F

Fred Oz

Michael Winter wrote:
[snip]
Using: document.write(new Date("2001/1/1 0:0:0R"));

Opera 7.54: Mon, 01 Jan 2001 00:00:00 GMT+0000
IE 6.0.2900.2180: Sun Dec 31 19:00:00 UTC 2000
Gecko[1]: Invalid Date
NN4: Invalid Date


and in Safari 1.0.3 (v85.8):

document.write(new Date("2001/1/1 0:0:0R"));

gives:

Sun Oct 25 1959 00:00:00 GMT+1000


regarless of the trailing character (R,S,T,Z,G,'' tested)



Fred.
 
M

Mick White

Dr said:
What do other browsers show for new Date("2001/1/1 0:0:0R") ?

Safari 1.0.3: Sun Oct 25 1959 00:00:00 GMT-0400
Mozilla 1.6: Invalid Date
FF 0.9: Invalid Date
Camino 0.8b: Invalid Date
IE 5.2: Sun Dec 31 15:00:00 EDT 2000

All Mac
Mick
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Tue, 5 Oct 2004 14:25:25, seen in Mick White
Safari 1.0.3: Sun Oct 25 1959 00:00:00 GMT-0400

That's impressively wrong.
Mozilla 1.6: Invalid Date
FF 0.9: Invalid Date
Camino 0.8b: Invalid Date
IE 5.2: Sun Dec 31 15:00:00 EDT 2000

EDT for a winter date? EDT in Australia?

One should really look at new Date("2001/1/1 0:0:0R").toUTCString()

The correct answer is, I believe, Mon, 1 Jan 2001 05:00:00 UTC or
local equivalent; but RFCs reversed the military standard..


Clearly, however,
(a) The notation is unsafe in javascript
(b) But worth knowing of, as it explains why such as
01:02:03A and 02:03:04P are not taken as AM and PM.


Fred Oz, in AU, with Safari, got similarly
Sun Oct 25 1959 00:00:00 GMT+1000
regardless of the trailing character (R,S,T,Z,G,'' tested)

That deserves further testing; it appears that "YYYY/M/D" is perhaps
misunderstood, and I had thought that to be safe. Changing each of
Y,M,D slightly may provide clues.
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated
Tue, 5 Oct 2004 18:36:38, seen in Andrew
Thompson said:
You want me to knock the 'Language/Regional' into some
semblance of reality and try again?

No need; it is already clear that the notation is never right (i.e.
apart from Z, != military notation, being reversed) and in its manner of
being wrong is not reliable. But knowledge of it might be useful, to
explain

It would indeed have been better if I had put
new Date("2001/1/1 0:0:0R").toUTCString()
since local time where January is in Summer and when it's near the
equinoxes only adds potential for error.

But I would be pleased to hear whether EST in your header stands for
Eastern Standard Time or something else, and what the summer/winter
terms are for various parts of Australia (& Lord Howe Island!).

If you're near Glen Innes, I might be able to get you offered a cup of
tea.
 
J

Jim Ley

Dr said:
IE 5.2: Sun Dec 31 15:00:00 EDT 2000
[snip]

EDT for a winter date? EDT in Australia?

Rochester, NY, USA: Eastern Daylight Savings Time

In mid-december? When does Rochester go off daylight savings then?
or does it not? is there a double daylight savings in summer as is
often proposed in the UK?

Jim.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top