const times = () => {
// 获取当前时间
var current = new Date()
// 获取减去12 小时的时间戳
current.setTime(current.getTime() - (60 * 60 * 1000*4))
// 通过规则转换格式
var formatted = current.toISOString().replace(/T/, ' ').replace(/\..+/, '')
// 返回数据
return formatted
}
js 获取当前时间减12小时的时间 并转换为YYYY-mm-dd HH:mm:ss
于 2024-03-06 08:34:28 首次发布