web stats
JavaScript Date.parse adds offset from UTC? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-01-2011, 10:56 AM
DavidL DavidL is offline
OBX.1 Kenobi
 
Join Date: Sep 2011
Location: Dayton Ohio
Posts: 43
DavidL is on a distinguished road
Default JavaScript Date.parse adds offset from UTC?

I'm processing a delimited text file. The first field is a date/time in ISO format i.e.
"2011-11-28T22:24:15.634Z"
(minus the quotes).

I notice that when I use the JavaScript Date.parse() method, I get back 2011-11-29 03:24:15.634 -- that is, DateTime.parse() seems to be adding in the offset (from GMT/UTC) for my time zone (which is US Eastern).

But the 'Z' indicates the date/time is *already* UTC (and therefore should not be converted).

I tried this in Internet Explorer and Chrome, and it works as I expected (i.e. it interprets the string as a UTC timestamp and does _not_ add the offset).

Obviously I can work around this by parsing the date string myself ... but why should I have to reinvent the wheel?
Is there something I'm missing?

TIA
Reply With Quote
Reply

Tags
conversion, date, javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:00 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation