Christian Fazzini Christian Fazzini - 8 months ago 32
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.


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"