JavaScript: Date.UTC

By Xah Lee. Date: . Last updated: .
Date.UTC( year, month )
Return the milliseconds representation of current datetime. Sample return value: 1428601360919.
The year and month arguments are required.
Date.UTC( year, month , date , hours , minutes , seconds , ms )
If less than 2 arguments are given, result is implementation dependent.
The parameters are exactly the same as the mulitple number type parameters version of new Date(args), but interprets them as UTC. [see Date Constructor]

Other parameter form such as Date.UTC() or Date.UTC(string) are not allowed.

const d = Date.UTC ( 2016, 12 , 17 );
console.log( d ); // 1484611200000
console.log( (new Date(d)).toString() ); // Mon Jan 16 2017 16:00:00 GMT-0800 (PST)
// these parameters are not allowed
console.log( Date.UTC () === NaN ); // true
console.log( Date.UTC ("2015-04-08T15:48:22.000Z") === NaN ); // true
JS in Depth
XAH  BUY NOW

JS in Depth

JS Obj Ref

DOM


JS Obj Ref

Date

prototype