1

I have a time stamp in ISO 8601 I pass it to Date JavaScript object as a string and JavaScript instantiate an object from it that holds the specified date and time. Example:

var datetime = new Date('2013-07-18T19:17:09+03:00');

This works on Google Chrome and I wonder if it will on most major browsers? If not what is the most compatible JavaScript time-format for Date object? Thanks

0xC0DEGURU
  • 1,432
  • 1
  • 18
  • 39
  • 2
    The really most compatible is probably the UNIX epoch offset. Not really user friendly mind you. – Lloyd Jul 19 '13 at 13:28

1 Answers1

2

Personally, I like ISO 8601 as a date/time string format, mostly because it is easily readable (which may not be a concern for you). I don't think support for it in the JavaScript Date object works across all browsers though.

I usually end up using some version of the parsing code here: http://dansnetwork.com/javascript-iso8601rfc3339-date-parser/

Related question: JavaScript: Which browsers support parsing of ISO-8601 Date String with Date.parse

Community
  • 1
  • 1
WildCrustacean
  • 5,896
  • 2
  • 31
  • 42