I want to convert date to timestamp, my input is 26-02-2012
. I used
new Date(myDate).getTime();
It says NaN.. Can any one tell how to convert this?
datejavascripttime
I want to convert date to timestamp, my input is 26-02-2012
. I used
new Date(myDate).getTime();
It says NaN.. Can any one tell how to convert this?
Best Answer
Split the string into its parts and provide them directly to the Date constructor:
Update:
Updated: Also, you can use a regular expression to split the string, for example: