setUTCHours (JavaScript)

Sets the hour in UTC. Optionally sets the minute, second, and millisecond in UTC.

Defined in

Date (Standard - JavaScript)

Syntax

setUTCHours(hours:int) : long

setUTCHours(hours:int, min:int) : long

setUTCHours(hours:int, min:int, sec:int) : long

setUTCHours(hours:int, min:int, sec:int, ms:int) : long

Parameters Description
hours The hour in UTC time where the hours in a day are 0 through 23.
min The minute in UTC time where the minutes in an hour are 0 through 59.
sec The seconds in UTC time where the seconds in a minute are 0 through 59.
ms The milliseconds in UTC time where the milliseconds in a second are 0 through 999.
Return value Description
long The new time in numeric format.

Examples

This computed label sets the current time to the next hour.
var date = new Date();
date.setUTCHours(date.getUTCHours() + 1, 0, 0, 0);
date.toUTCString()