JS: Date.UTC
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 multiple number type parameters version ofnew 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