var myDate = new Date();
var year = myDate.getFullYear();
var month = myDate.getMonth() + 1;
var date = myDate.getDate();
var h = myDate.getHours();
var m = myDate.getMinutes();
var s = myDate.getSeconds();
var now = year + "-" + month + "-" + date + " " + h + ":" + m + ":" + s;
console.log(now);
js获得当前时间
最新推荐文章于 2020-12-03 07:40:15 发布