This piece of Javascript is a very handy extenion to the Date object. It allows you to output your dates using the same format as PHP's date function.
It currently doesn't support all of the characters, but I've done the essential ones, and any others can be done on request.

//Make a new Date object
var date = new Date(1397674088445);

//Get the format
var formatted = date.format("H:i d/m/y");

//Do with it what you want
formatted == "04:48 17/04/14"
//Note the time is AEST, because that is my computer's time.

Milliseconds since Epoch: and string format:
Result: " "

You can download the source from here, or there is also a compacted version (~ 3.5Kb) available here.