直接放代码
getNowDate() {
var myDate = new Date;
var year = myDate.getFullYear()
var mon = myDate.getMonth() + 1
var date = myDate.getDate()
var hours = myDate.getHours()
var minutes = myDate.getMinutes()
var seconds = myDate.getSeconds()
var now = year + "-" + mon + "-" + date + " " + hours + ":" + minutes + ":" + seconds
return now
},
输出一下,格式如下: