使用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
原文地址:https://www.cnblogs.com/huanhuan55/p/11260652.html