var myDate = new Date(); var epoch = myDate.getTime(); //1318023197289 number of ms since epoch var unixEpoch = Math.round(epoch/1000)
epoch
var date = new Date(1318023197289);
And, since unixEpoch is simply epoch / 1000, you can similarly multiply the argument in the constructor by 1000.
1.4m articles
1.4m replys
5 comments
57.0k users