Javascript Invalid Date Error in Internet Explorer

date, internet-explorer, javascript

Solution

The string given to the date constructor should be an RFC2822 or ISO 8601 formatted date. In your example it isn't. Try the following:

new Date("2012-11-02T19:30:00.000Z");

or using an alternate constructor:

new Date(2012, 11, 2, 19, 30, 0)

Problem

Relatively simple javascript here, not sure why IE hates me (treat others how you want to be treated I suppose). ``` var newDate = new Date("2012, 11, 2 19:30:00:000"); alert(newDate); ``` This works in Chrome and FF, but IE outputs "Invalid Date" Fiddle me this: http://jsfiddle.net/k6yD6/

Original source

Related problems