javascript convert string to datetime code example
Example 1: convert string to datetime javascript
var s = '01-01-1970 00:03:44';
var d = new Date(s);
console.log(d); // ---> Thu Jan 01 1970 00:03:44 GMT-0500 (Eastern Standard Time)
Example 2: convert javascritp getTime() to datetime
var time = new Date().getTime(); // get your number
var date = new Date(time); // create Date object
console.log(date.toString()); // result: Wed Jan 12 2011 12:42:46 GMT-0800 (PST)