Javascript 瞬间js给出了意外的日期
我正在使用moment.js处理日期,但使用它时会出现意外的日期Javascript 瞬间js给出了意外的日期,javascript,momentjs,Javascript,Momentjs,我正在使用moment.js处理日期,但使用它时会出现意外的日期 const moment = require('moment'); console.log(moment().startOf('day').toDate()); console.log(矩().startOf('day').toDate()) 它给你当地时间午夜,但你在祖鲁时间打印出来。尝试改用toString,它将以本地时间打印超时 尝试moment().startOf('day').toString()起初我以为这是夏令时
const moment = require('moment');
console.log(moment().startOf('day').toDate());
console.log(矩().startOf('day').toDate())代码>
它给你当地时间午夜,但你在祖鲁时间打印出来。尝试改用toString,它将以本地时间打印超时
尝试moment().startOf('day').toString()代码>起初我以为这是夏令时的问题,但这可以解释为什么是23:00:00
,而不是21
。我觉得这一定是个时区问题,你说得对吗