You can use the Date
constructor which takes in a number of milliseconds and converts it to a JavaScript date:
var d = new Date(Date.now());
d.toString() // returns "Sun May 10 2015 19:50:08 GMT-0600 (MDT)"
In reality, however, doing Date(Date.now())
does the same thing as Date()
, so you really only have to do this:
var d = new Date();
d.toString() // returns "Sun May 10 2015 19:50:08 GMT-0600 (MDT)"