You can use the
getTime() of the object
// Pegar do horário atual
var timestamp = new Date().getTime();
// Pegar de uma data específica
var timestamp = new Date(2013, 11, 17).getTime();
But be careful because this date / time is provided by the client operating system, if you need some security or the information is for the base, use some method in your application on the server (backend).
An important detail that went unnoticed by me - and it seems like by all - is that the month parameter of the constructor of the
Date object is indexed by zero (zero-indexed) begins counting from scratch, then: 0 = January and 11 = December. In the example above, I used the number
12 to extract today's date (12/17/13) however as December is 11, the result of the example is
Fri Jan 17 2014 00:00:00 GMT-0200 (Horário brasileiro de verão) , that is, January , because it throws the date forward - or backwards - doing the calculation. But that's another story.