Fork me on GitHub

使用moment格式化

var DateTime = "Sun Jul 28 2019 00:00:00 GMT+0800 (中国标准时间)"

var  curTime = moment(DateTime).format("HH:mm:ss");

console.log(curTime)  //输出: 00:00:00

var  curTime = moment(DateTime).format("hh:mm:ss");

console.log(curTime)  //输出: 12:00:00

 

posted @ 2019-07-28 19:59  欢欢11  阅读(369)  评论(0编辑  收藏  举报