No announcement yet.

JavaScript Date.parse adds offset from UTC?

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.
    (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?