console.log(new Date(2022))
// 只传入一个参数: (秒)
// Thu Jan 01 1970 08:00:02 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0))
// 传入两个参数: (年, 月)
// Sat Jan 01 2022 00:00:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 20))
// 传入两个参数: (年, 月)
// Fri Sep 01 2023 00:00:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 40))
// 传入三个参数: (年, 月, 日)
// Wed Feb 09 2022 00:00:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 60))
// 传入三个参数: (年, 月, 日)
// Tue Mar 01 2022 00:00:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 20, 12))
// 传入四个参数: (年, 月, 日, 时)
// Thu Jan 20 2022 12:00:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 20, 25))
// 传入四个参数: (年, 月, 日, 时)
// Fri Jan 21 2022 01:00:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 20, 9, 30))
// 传入四个参数: (年, 月, 日, 时, 分)
// Thu Jan 20 2022 09:30:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 20, 9, 75))
// 传入四个参数: (年, 月, 日, 时, 分)
// Thu Jan 20 2022 10:15:00 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 20, 9, 30, 45))
// 传入五个参数: (年, 月, 日, 时, 分, 秒)
// Thu Jan 20 2022 09:30:45 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 20, 9, 30, 85))
// 传入五个参数: (年, 月, 日, 时, 分, 秒)
// Thu Jan 20 2022 09:31:25 GMT+0800 (中国标准时间)
console.log(new Date(2022, 0, 20, 9, 30, -30))
// 传入五个参数: (年, 月, 日, 时, 分, 秒)
// Thu Jan 20 2022 09:29:30 GMT+0800 (中国标准时间)
从像 2022/07/07 这样的形状转换为像“1657202104”这样的形状。
因为 Date 对象以毫秒为单位,需要转换为秒才能转换为 UnixTime timestamp / 1000。