JS 前端获得时间
作者:互联网
//获取系统当前时间
var nowdate = new Date();
var y = nowdate.getFullYear();
var m = nowdate.getMonth()+1;
var d = nowdate.getDate();
var formatnowdate = y+'-'+m+'-'+d;
//获取系统前一个月的时间
nowdate.setMonth(nowdate.getMonth()-1);
var y = nowdate.getFullYear();
var m = nowdate.getMonth()+1;
var d = nowdate.getDate();
var formatwdate = y+'-'+m+'-'+d;
标签:前端,getFullYear,JS,获得,获取,nowdate,var,getMonth,getDate 来源: https://www.cnblogs.com/hehuarong/p/15146155.html