How to get time in milliseconds since the unix epoch in Javascript? [duplicate]

How to get time in milliseconds since the unix epoch in Javascript? [duplicate]

Possible Duplicate:
How do you get a timestamp in JavaScript?
Calculating milliseconds from epoch

How can I get the current epoch time in Javascript? Basically the number of milliseconds since midnight, 1970-01-01.

Solutions/Answers:

Solution 1:

var milliseconds = (new Date).getTime();

Solution 2:

new Date().valueOf() will do the trick.

Related:  Convert to uppercase as user types using javascript