Christian Fazzini Christian Fazzini - 1 year ago 92
Javascript Question

How to convert milliseconds into a readable date?

The following:

new Date(1324339200000).toUTCString()


"Tue, 20 Dec 2011 00:00:00 GMT"

I need it to return
Dec 20
. Is there a better method I can use besides
? I am looking for any way to parse through milliseconds, to return a human readable date.

Answer Source

Using the library Datejs you can accomplish this quite elegantly, with its toString format specifiers:

var date = new Date(1324339200000);

date.toString("MMM dd"); // "Dec 20"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download