jquery生成当前日期

var date = new Date();                //得到当前日期原始模式
var newyear = date.getFullYear();     //得到当前日期年份
var newmonth = date.getMonth() + 1;   //得到当前日期月份(注意: getMonth()方法一月为 0, 二月为 1, 以此类推。)
var day = date.getDate();            //得到当前某日日期(1-31)
newmonth = (newmonth<10 ? "0"+newmonth:newmonth);  //10月以下的月份自动加0
var newdate = newmonth + "月" + day +"日";
	$("#sysday span").html(newdate);
结果例:05月15日

猜你喜欢

转载自blog.csdn.net/qq_42207957/article/details/80323741