js获取当前日期事件(yyyy-MM-dd HH:mm:ss)
function getDataTimeNow() {
var nowstr = new Date();
var datenow = nowstr.getFullYear() + "-"
+ ((nowstr.getMonth() + 1) < 10 ? "0" : "") + (nowstr.getMonth() + 1) + "-"
+ (nowstr.getDate() < 10 ? "0" : "") + nowstr.getDate()
+ " "
+ (nowstr.getHours() < 10 ? "0" : "") + nowstr.getHours() + ":"
+ (nowstr.getMinutes() < 10 ? "0" : "") + nowstr.getMinutes() + ":"
+ (nowstr.getSeconds() < 10 ? "0" : "") + nowstr.getSeconds();
return datenow;
}
浙公网安备 33010602011771号