moment.js get current time in milliseconds?

前端 未结 7 1130
旧巷少年郎
旧巷少年郎 2021-02-01 11:54
var timeArr = moment().format(\'HH:mm:ss\').split(\':\');

var timeInMilliseconds = (timeArr[0] * 3600000) + (timeArr[1] * 60000);

This solution works,

相关标签:
7条回答
  • 2021-02-01 12:23

    To get the current time's milliseconds, use http://momentjs.com/docs/#/get-set/millisecond/

    var timeInMilliseconds = moment().milliseconds();
    
    0 讨论(0)
提交回复
热议问题