.UTC()
christian.dinh2476 total contributions
Published Jul 22, 2021Updated Sep 3, 2021
Contribute to Docs
The .UTC()
static method of Date
that returns a number value representing the number of milliseconds between the specified date and January 1, 1970, 00:00:00, Universal Time Coordinated. Will always be called as Date.UTC()
rather than called on an instance of date such as myDate.UTC()
.
Syntax
Date.UTC(year, month, day, hour, minute, second, millisecond);
year
(required): The year in four-digit format. If only two digits are specified, the year is assumed to be in twentieth century.month
(optional): The range is from0
to11
.day
(optional): The range is from1
to31
.hour
(optional): The range is from0
to23
.minute
(optional): The range is from0
to59
.second
(optional): The range is from0
to59
.millisecond
(optional): The range is from0
to999
.
Note: UTC, Universal Time Coordinated, is the time set by the World Time Standard.
Example 1
Return the number of milliseconds between the specified date and January 1, 1970, 00:00:00, universal time.
var midnight1971 = Date.UTC(1971, 00, 01, 0, 0, 0);console.log(midnight1971);// Output: 34214400000
All contributors
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- robgmerrill124 total contributions
- christian.dinh
- Anonymous contributor
- robgmerrill
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.