JavaScript UTC() Method
Example
Returns the number of milliseconds from January 1, 1970 to a specified date:
var d=Date.UTC(2012,02,30);
d Output result:
Try it »
Definition and Usage
The UTC() method returns the number of milliseconds from January 1, 1970 to a specified date based on Coordinated Universal Time
**Tip:** Coordinated Universal Time, also known as Universal Time, Universal Standard Time, or International Coordinated Time, abbreviated as UTC (Universal Coordinated Time).
**Note:** UTC is the same as GMT (Greenwich Mean Time).
Browser support





All major browsers support the UTC() method.
Syntax
Date.UTC(
year
,
month
,
day
,
hours
,
minutes
,
seconds
,
millisec
)
Parameter Values
| Parameters | 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 minutes, between 0 and 59. |
| seconds | Optional. An integer representing the seconds, between 0 and 59. |
| ms | Optional. An integer representing the milliseconds, between 0 and 999. |
Return Value
| Type | Description |
|---|---|
| Number | Returns the number of milliseconds from midnight, January 1, 1970 GMT, to the specified time. |
Technical Details
| JavaScript version: | 1.0 |
|---|
More examples
Example
Converts local time to UTC time:
var d=new Date(Date.UTC(2012,02,30));
d Output result:
Try it »
JavaScript Date object