如何在将毫秒传递给moment()时获得实际的实时日期

  • 本文关键字:日期 实时 moment momentjs
  • 更新时间 :
  • 英文 :


从'moment'导入moment;

const millseconds =21212121221212
const realDate = moment(millseconds) // I want to got the date in the format of DD:MM::YYYY but I didn't get anything
moment(1318781876406).format('DD:MM::YYYY')

打印此:

09:03::2642

这应该以当地日期时间格式为您提供相应的时刻日期

注意:如果您在新项目中使用moment.js,请考虑阅读此

最新更新