How to convert milliseconds into a readable date?
Using the library Datejs you can accomplish this quite elegantly, with its toString
format specifiers: http://jsfiddle.net/TeRnM/1/.
var date = new Date(1324339200000);
date.toString("MMM dd"); // "Dec 20"
You can use datejs and convert in different formate. I have tested some formate and working fine.
var d = new Date(1469433907836); // Parameter should be long value
d.toLocaleString() // 7/25/2016, 1:35:07 PM
d.toLocaleDateString() // 7/25/2016
d.toDateString() // Mon Jul 25 2016
d.toTimeString() // 13:35:07 GMT+0530 (India Standard Time)
d.toLocaleTimeString() // 1:35:07 PM
d.toISOString(); // 2016-07-25T08:05:07.836Z
d.toJSON(); // 2016-07-25T08:05:07.836Z
d.toString(); // Mon Jul 25 2016 13:35:07 GMT+0530 (India Standard Time)
d.toUTCString(); // Mon, 25 Jul 2016 08:05:07 GMT