Javascript date getTime() method returns the numeric value corresponding to the time for the specified date according to universal time. The value returned by the getTime method is the number of milliseconds since 1 January 1970 00:00:00.
You can use this method to help assign a date and time to another Date object.
Its syntax is as follows −
Date.getTime()
Returns the numeric value corresponding to the time for the specified date according to universal time.
Try the following example.
<html> <head> <title>JavaScript getTime Method</title> </head> <body> <script type="text/javascript"> var dt = new Date( "December 25, 1995 23:15:20" ); document.write("getTime() : " + dt.getTime() ); </script> </body> </html>
getTime() : 819954920000