Date.parse() results in NaN

Date.parse();

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

Really confused about this...Is someone has such experience before?

Answers


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

Change - to /

Good read: Jquery Date.parse returning NaN in Chrome browser? or https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date

Try this:

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

Hope this fits the cause! B-)


The date should be in the IETF date syntax (RFC2822 Section 3.3) format, e.g. "Mon, 25 Dec 1995 13:30:00 GMT", or "Mon, 25 Dec 1995 13:30:00 GMT+0430".

Read more: Date.parse()

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


Need Your Help

Connect with iOS and Android clients to SockJS Backend

java android ios spring spring-websocket

I'm developing WebSocket messaging backend using Spring WebSockets, which uses SockJS + STOMP protocol. The reason why not to use plain WebSockets is because I will need to leverage security integr...

GridLayout from support library does not show 2 rows on Android 2, onChildVisibilityChanged Error

android android-layout android-widget grid-layout android-compatibility

Has anybody gotten the support library to render a grid layout correctly in Android 2? Instead of 2 rows and columns I get a single row on the screen and see this error in the logcat output: