English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The setUTCHours() method sets the hour (0 ~ 23).
This method can also be used to set minutes, seconds, and milliseconds.
World Standard Time (UTC) is the time set by the world time standard.
date.setUTCHours(hours, minutes, seconds, millisec)
var d = new Date(); d.setUTCHours(18);Test to see‹/›
If the minutes, seconds, and millisec parameters are not specified, the values returned by getUTCMinutes(), getUTCSeconds(), and getUTCMilliseconds() methods are used.
All browsers fully support the setUTCHours() method:
Method | |||||
setUTCHours() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
hours | (Required) 0 to23representing hours. If the provided value is greater than23If the number is between |
minutes | (Optional) 0 to59representing minutes. If the provided value is greater than59If the number is between |
seconds | (Optional) 0 to59representing seconds. If the provided value is greater than59If the number is between If specifiedsecondsIf the parameter is not specified, it must also be specifiedminutesParameters. |
millisec | (Optional) 0 to999between the numbers, indicating milliseconds. If the provided value is greater than999, the date and time will be increased by an additional millisecond. If specifiedmillisecIf the parameter is not specified, it must also be specifiedMinuteandSecondParameters. |
Return Value: | 1970 Year1Month1Milliseconds between the date and time '00:00:00 UTC' and the update date |
---|---|
JavaScript Version: | ECMAScript 1 |