1

How can I convert 2017-04-13T06:26:00.000+0000 to ISO or date format, I added 2017-04-13T06:26:00.000+0000 into new Date() Its working fine for chrome and mozilla but its showing invalid date for internet explorer

1 Answers1

0

The ECMAScript standard (which is basically the Javascript standard) explains how the language supports "a simplified version" of ISO-8601 (the date format). In the case where the date is input "simplified", really means limited. Of course, good browsers just follow the entire ISO date standard, but others (read: IE) only follow the simplified format.

The string you provided does not adhere to this simplified date standard. In particular, the problem here is the timezone. The ISO standard allows you to specify anything from +05 to +0500 to +05:00. In the official javascript subset, only the last form is correct. Thus, your string is missing a colon that's required in javascript.

The solution is probably to change the date somewhat so it does include a colon, or adheres to the javascript ISO subset in some other way. Alternatively, you can use a library that fully supports ISO 6801.

Jasper
  • 11,590
  • 6
  • 38
  • 55