Name
Date.UTC() — convert a Date specification to milliseconds
Synopsis
Date.UTC(year,month,day,hours,minutes,seconds,ms)
Arguments
yearThe 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.
monthThe month, specified as an integer from 0 (January) to 11 (December).
dayThe 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.
hoursThe hour, specified as an integer from 0 (midnight) to 23 (11 p.m.). This argument is optional.
minutesThe minutes in the hour, specified as an integer from 0 to 59. This argument is optional.
secondsThe seconds in the minute, specified as an integer from 0 to 59. This argument is optional.
msThe 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access