//获取当前年月日时分秒
function getNowDate(){
let myDate = new Date;
let year= new Date().getFullYear()
let mon = new Date().getMonth() + 1< 10 ? '0' + (new Date().getMonth()+1):new Date().getMonth() + 1
let date= new Date().getDate()< 10 ? '0' + new Date().getDate():new Date().getDate()
let hours= new Date().getHours() < 10 ? '0' + new Date().getHours():new Date().getHours()
let minutes = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes():new Date().getMinutes()
let seconds= new Date().getSeconds() < 10 ? '0' + new Date().getSeconds():new Date().getSeconds()
var now = year + "-" + mon + "-" + date + " " + hours + ":" + minutes + ":" + seconds;
return now
}
js获取当前时间年月日时分秒
于 2022-11-14 13:58:15 首次发布