Name
Date.UTC() — convert a Date specification to milliseconds
Synopsis
Date
.
UTC
(
year
,
month
,
day
,
hours
,
minutes
,
seconds
,
ms
)
Arguments
year
The year in four-digit format. If this argument is between 0 and 99, inclusive, 1900 is added to it and it is treated as a year between 1900 and 1999.
month
The month, specified as an integer from 0 (January) to 11 (December).
day
The day of the month, specified as an integer from 1 to 31. Note that this argument uses 1 as its lowest value, while other arguments use 0 as their lowest value. This argument is optional.
hours
The hour, specified as an integer from 0 (midnight) to 23 (11 p.m.). This argument is optional.
minutes
The minutes in the hour, specified as an integer from 0 to 59. This argument is optional.
seconds
The seconds in the minute, specified as an integer from 0 to 59. This argument is optional.
ms
The number of milliseconds, specified as an integer from 0 to 999. This argument is optional and is ignored prior to ECMAScript standardization.
Returns
The millisecond representation of the specified universal time. That is, this method returns the number of milliseconds between midnight GMT on January 1, 1970 and the specified time.
Description
Date.UTC()
is a static
method; it is invoked through the Date()
constructor, not through an
individual Date object.
The arguments to Date.UTC()
specify a date and time and are understood to be in UTC; they are in the GMT time zone. The specified UTC time is converted to the millisecond format, which can be used ...
Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.