Node.JS 获取时间戳(毫秒,秒)
Node.JS 获取时间戳(毫秒,秒)
2022-04-21 0 评论 2 阅读 0 点赞

Node.JS 获取时间戳(毫秒,秒)

daimafengzi
2022-04-21 / 0 评论 / 2 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年04月20日,已超过1554天没有更新,若内容或图片失效,请留言反馈。
/**
 * 获取当前时间戳(毫秒)
 */
function getNowMilliSecond(){
    return Math.floor(Date.now());
}
 
/**
 * 获取当前时间戳(秒)
 */
function getNowSceond(){
    return Math.floor(Date.now() / 1000);
}
 
//当前时间戳(毫秒)
console.log("curMilliSecond=%d",getNowMilliSecond());   //输出:curMilliSecond=1608090151913
//当前时间戳(秒)
console.log("curSecond=%d",getNowSceond());             //输出:curSecond=1608090151
0

评论 (0)

取消