js获取日期时间
作者:互联网
function getNowFormatDate() { //获取当前时间
var date = new Date();
var symbol_gang = "-";
var symbol_maohao = ":";
var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var strDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var currentdate = date.getFullYear() + symbol_gang + month + symbol_gang + strDate
+ " " + date.getHours() + symbol_maohao + date.getMinutes()
+ symbol_maohao + date.getSeconds();
return currentdate;
}
标签:symbol,var,获取,日期,gang,date,js,maohao,getMonth 来源: https://www.cnblogs.com/jiqing9006/p/11308001.html