Date.UTC

UTC – Get the timestamp in milliseconds of the given UTC time.

Description

Date.UTC(integer year, integer month, integer day, [integer hour, [integer minutes, [integer seconds, [integer milliseconds]]]])

Parameters

Name Description Type Default Optional
year The year. integer No
month Integer between 0 and 11. integer No
day Integer between 1 and 31. integer No
hour Integer between 0 and 23. integer Yes
minutes Integer between 0 and 59. integer Yes
seconds Integer between 0 and 59. integer Yes
milliseconds Integer between 0 and 999. integer Yes

Return values

Integer

Examples

Example #1 – UTC example
var utcDate = Date.UTC(2015, 9, 21, 16, 29, 00); var localDate = new Date(utcDate); console.log(utcDate); // The timestamp. console.log(Math.round(utcDate / 1000)); // The timestamp rounded to closest second. console.log(localDate.getUTCHours(), localDate.getUTCMinutes()); // The UTC time, as specified in the constructor. console.log(localDate.getHours(), localDate.getMinutes()); // The local time.

External references