JS 获取当前日期(yy-mm-dd HH-MM-SS)
2021-06-22 12:04
标签:日期 date date() 获取 min mon current get tno function getNowDate() { if (Hours >= 0 && Hours Hours = "0" + Hours; JS 获取当前日期(yy-mm-dd HH-MM-SS) 标签:日期 date date() 获取 min mon current get tno 原文地址:http://www.cnblogs.com/xiaomixia/p/7170555.html
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month month = "0" + month;
}
if (strDate >= 0 && strDate strDate = "0" + strDate;
}
var Hours = date.getHours();
var Minutes = date.getMinutes();
var Seconds = date.getSeconds();
}
if (Minutes >= 0 && Minutes Minutes = "0" + Minutes;
}
if (Seconds >= 0 && Seconds Seconds = "0" + Seconds;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + Hours + seperator2 + Minutes
+ seperator2 + Seconds;
return currentdate;
}
文章标题:JS 获取当前日期(yy-mm-dd HH-MM-SS)
文章链接:http://soscw.com/essay/97367.html