parse UTC

239 views
Skip to first unread message

Nick Franceschina

unread,
Aug 23, 2010, 7:25:25 PM8/23/10
to Datejs - A JavaScript Date Library
PS - I am in Eastern Timezone:


Date.parse("2010-11-27T00:12:12Z")
>> Sat Nov 27 2010 00:12:12 GMT-0500 (Eastern Standard Time)
[wrong - the timezone is specified in the string as UTC]

Date.parse("2010-11-27T00:12:12Z").setTimezone('Z')
>> Fri Nov 26 2010 19:12:12 GMT-0500 (Eastern Standard Time)
[correct... but why do I have to tell it about "Z" twice?]

Date.parse("2010-11-27T00:12:12Z").setTimezone('Z').toISOString()
>> "2010-11-27T00:12:12.000Z" [correct]

Date.parse( Date.parse("2010-11-27T00:12:12Z").setTimezone('Z').toISOString() )
>> null [how can it not parse its own ISO output?]



Reply all
Reply to author
Forward
0 new messages