Parameters: This method does not accept any parameter.
Return type: A numeric value equal to no of milliseconds since Unix Epoch.
Below are examples of the Date getTime() Method:
Example 2: Here, the date of the month must lie between 1 to 31 because no date can have a month greater than 31. That is why it returns NaN i.e, Not a Number if the month in the Date object is greater than 31. Hours will not have existed when the date of the month is given as 33 i.e, greater than 31.
Example 3: Here, we will calculate the user’s age by providing the birth date of the user.
- Google Chrome 1.0
- Microsoft Edge 12.0
- Firefox 1.0
- Internet Explorer 4.0
- Opera 3.0
- Safari 1.0
Please Login to comment...