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/
The JavaScript exception "invalid date" occurs when a string leading to an invalid date has been provided to Date or Date. parse() .
The JavaScript toDateString() method returns the date portion of a date object in the form of a string using the following format: First three letters of the week day name. First three letters of the month name. Two digit day of the month, padded on the left a zero if necessary.
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)
IE does not seem to support millisecond and months in Numerical String. Try this:
new Date("November 2, 2012 19:30:00");
or
new Date(year, month, day, hours, minutes, seconds, milliseconds)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With