Date.UTC( year, month, [ day ], [ hour ], [ minute ], [ second ], [ ms ] ) in ECMAScript 262
Return the number of milliseconds corresponding to the supplied arguments.
Arguments
name | type | description |
---|---|---|
year | Number | The UTC year number. |
month | Number | The zero-based UTC month numbe |
day | Number | [optional] The UTC day number. |
hour | Number | [optional] The UTC hours. |
minute | Number | [optional] The UTC minutes. |
second | Number | [optional] The UTC seconds. |
ms | Number | [optional] The UTC milliseconds. |
- Return Type
- Number
Description
This method applies to the Date class, not a particular instance; appropriate usage is:
var numMilliseconds = Date.UTC(...);
This method is used by the new Date()
constructor when more than one argument is passed, so the following two methods of creating a date are equivalent:
var numMilliseconds = Date.UTC(2003,11,24);
var myDate1 = new Date(numMilliseconds);
var myDate2 = new Date(2003,11,24);
var numMilliseconds = myDate2.valueOf();
As such, this method is solely useful when only the date value (as a number) is important instead of the full Date
object it represents.
Note: The month
property is zero-based; 0 corresponds to January, and (as above) 11 corresponds to December.