npm install datex.js
datex().getTime()
// => 1670768193313
datex().getUnix()
// => 1670768193
datex().clone()
datex().toDate()
// => Sun Dec 11 2022 22:20:20 GMT+0800 (中国标准时间)
datex().toDate()
// => {
year:2022,
month:12,
day:11,
hour:22,
minute:23,
second: 14,
millsecond:612,
timestamp:1670768594612,
week:0
}
datex().toArray()
// => [2022,12,11,22,23,14,612]
datex().toDate()
// => Sun Dec 11 2022 22:20:20 GMT+0800 (中国标准时间)
datex().toDate()
// => 2023-04-12T07:20:23.363Z
datex(2022,10,1).format('YYYY-MM-DD HH:mm:ss')
// => 2022-10-01 00:00:00
datex(1671761818503).format('YYYY/MM/DD')
// => 2022/12/23
datex(2022,10,1).set('year',2020).format()
// => 2020-10-01 00:00:00
datex(2022,10,1).change('year',1).format()
// => 2022-10-01 00:00:00
datex(2022,10,10).startOf('month').format()
// => 2022-10-01 00:00:00
datex(2022,10,10).endOf('month').format()
// => 2022-10-31 23:59:59
datex(2022,10,1).get('year')
// => 2022
datex('1949-10-01').diffWith('2022-12-01','month')
// => -878
datex('2008-08-08').isBefore('2022-02-02')
// => true
datex('2008-08-08').isAfter('2022-02-02')
// => false
datex('2008-08-08').isSame('2022-02-02')
// => false
datex('2008-08-08').isBetween('2003-07-13','2022-02-02')
// => true