Sunday, May 19, 2024
65
rated 0 times [  71] [ 6]  / answers: 1 / hits: 86666  / 12 Years ago, fri, october 26, 2012, 12:00:00

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/


More From » internet-explorer

 Answers
117

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)

[#82329] Thursday, October 25, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raveno

Total Points: 453
Total Questions: 92
Total Answers: 92

Location: France
Member since Thu, Oct 27, 2022
2 Years ago
raveno questions
;