moment.js 时间戳与时间转换
moment.js 提供 unix 方法来实现时间转时间戳
moment("2020-01-01 00:00:00").unix(); //log:当前时间时间戳 1577808000
但是打印的时间戳为 10 位,而 moment()解析的位数为 13 位时间戳
moment(1597809182).format(); //log:1970-01-19T14:16:48+08:00
直接使用就会导致打印的时间为 1970...导致时间不准确,如果想要正确使用就得先将获取的时间戳乘 1000,会存在一些误差
moment(moment().unix() * 1000).format(); //log:2020-01-01T00:00:00+08:00