August 1999
Intermediate to advanced
1488 pages
72h 53m
English
date.getTime()
The getTime() method returns the equivalence of the Date object in milliseconds. The milliseconds are expressed as an integer representing the number of milliseconds between midnight January 1, 1970 (GMT) to the date and time specified in the Date object.
Tip
It is much easier to compare two different dates as milliseconds by using the getTime() method, rather than having to examine the individual parts of the date.
The code in Listing 6.79 displays the number of milliseconds that passed between midnight January 1, 1970 to midnight January 1, 2000 using the getTime() method.
Read now
Unlock full access