get current time

function formatDate(now) {
var year=now.getFullYear();
var month=now.getMonth()+1;
var date=now.getDate();
var hour=now.getHours();
var minute=now.getMinutes();
var second=now.getSeconds();
return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
}

let nowTime = new Date();
let time =formatDate(nowTime);
$('.nowtime').text(time)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325154961&siteId=291194637