Easy Tutorial
❮ Jsref Reduce Jsref Todatestring ❯

JavaScript UTC() Method

JavaScript Date Object

Example

Returns the number of milliseconds since January 1, 1970, 00:00:00 UTC to the specified date:

d output result:


Definition and Usage

The UTC() method returns the number of milliseconds between a specified date and midnight of January 1, 1970, according to universal time.

Note: Coordinated Universal Time (UTC), also known as universal coordinated time, world standard time, and international coordinated time.

Attention: UTC time is the same as GMT (Greenwich Mean Time).


Browser Support

UTC() is supported by all major browsers.


Syntax

Parameter Values

Parameter Description
year Required. A four-digit number representing the year.
month Required. An integer representing the month, between 0 and 11.
day Required. An integer representing the day of the month, between 1 and 31.
hours Optional. An integer representing the hour, between 0 and 23.
minutes Optional. An integer representing the minute, between 0 and 59.
seconds Optional. An integer representing the second, between 0 and 59.
ms Optional. An integer representing the millisecond, between 0 and 999.

Return Value

Type Description
Number Returns the number of milliseconds since midnight of January 1, 1970, GMT.

Technical Details

| JavaScript Version: | 1.0 | | --- | --- |


More Examples

Example

Convert local time to UTC time:

d output result:


JavaScript Date Object

❮ Jsref Reduce Jsref Todatestring ❯