//获取当前时间并且格式话
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
var hour=date.getHours();
var minu=date.getMinutes();
var second=date.getSeconds();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = year + seperator1 + month + seperator1 + strDate+" "+hour+":"+minu+":"+second;
return currentdate;
}版权声明:本文为zyilove34原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。