内部存储的是以毫秒为单位的时间戳。
new Date()
返回的是 UTC 时间。
new Date(2015, 3, 12, 6, 25, 58)
// 2015-04-11T22:25:58.000Z
月从 0 开始。
定义时,默认为当前时区。
new Date(2015, 3, 12)
// 2015-04-11T16:00:00.000Z
对应时间为当前时区的 00:00:00。
// 北京时间 2014-10-29 21:09:24.364
const now = new Date(); // 2014-10-29T13:09:24.364Z
now.setFullYear(2014); // 1414588164364
now.setMonth(3); // 1398776964364
now.setDate(4); // 1396616964364
now.setHours(4); // 1396555764364
now.setMinutes(24); // 1396556664364
now.setSeconds(46); // 1396556686364
now // 2014-04-03T20:24:46.364Z
// 北京时间 2020-10-29 21:12:41.399
const now = new Date(); // 2020-10-29T13:12:41.399Z
now.getMonth(); // 9;月份,从 0 开始算
now.getTime(); // 1603977161399;毫秒为单位的时间戳
now.getDay(); // 4;周几,周日为 0
now.getDate(); // 29;日期