首页 > 网站 > WEB开发 > 正文

js获取当前时间前一周时间前一个月时间

2024-04-27 15:13:15
字体:
来源:转载
供稿:网友
//获取系统当前时间        var nowdate = new Date();        var y = nowdate.getFullYear();        var m = nowdate.getMonth()+1;        var d = nowdate.getDate();        var formatnowdate = y+'-'+m+'-'+d;        $("#enddate").datebox("setValue",formatnowdate);        //获取系统前一周的时间        var oneweekdate = new Date(nowdate-7*24*3600*1000);        var y = oneweekdate.getFullYear();        var m = oneweekdate.getMonth()+1;        var d = oneweekdate.getDate();        var formatwdate = y+'-'+m+'-'+d;        $("#fdate").datebox("setValue",formatwdate);        //获取系统前一个月的时间        nowdate.setMonth(nowdate.getMonth()-1);        var y = nowdate.getFullYear();        var m = nowdate.getMonth()+1;        var d = nowdate.getDate();        var formatwdate = y+'-'+m+'-'+d;        $("#fdate").datebox("setValue",formatwdate);转载自:http://blog.csdn.net/james8870/article/details/53467183
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表