Date.parse () results in NaN

Date.parse(); 

My jsFiddle works fine, but run it in my ideal (both Aptana and WebStorm) shows NaN in console.log() output.

Really confused about this ... Has anyone had such an experience before?

+9
source share
2 answers

Working demo http://jsfiddle.net/7KfuM/

Change - to /

Useful reading: Does jquery Date.parse return NaN in Chrome browser? or https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date

Try it:

 var firstDayTimestamp = Date.parse("2009/07/13 00:00:00" + "-0500") / 1000; 

Hope this matches the case! B-)

+22
source

The date must be in the IETF date syntax format (RFC2822, section 3.3), for example, Mon, December 25, 1995 13:30:00 GMT or Mon, December 25, 1995 13:30:00 GMT + 0430 ".

Read more: Date.parse ()

Surprisingly, this should also be done for the current (2017) versions of IE (11.x) and FF (56.x) so that Date.parse works correctly.

+1
source

All Articles