JavaScript Date setHours()
JavaScript Date setHours()
The setHours() method is used to set the hour of a date. It can also be used to set minutes, seconds, and milliseconds.
Syntax:-
Its syntax is:- Date.setHours(hour, min, sec, milliseconds)
Return:-
Its return is:- number of milliseconds of new date from 1 January, 1970
Further Explanation:-
Paramter | Description |
hour | Required. The Hours from 0 to 23. |
min | Optional. The Minutes from 0 to 59. |
sec | Optional. The seconds from 0 to 59. |
milliseconds | Optional. The milliseconds from 0 - 999. |