js日期

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ZHOU_VIP/article/details/82957958
function initdatePicker(){
    $('#gprs_rpt_topn_bt').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
      });    
    $('#gprs_rpt_topn_et').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
      });
    var curDate = new Date();
    $('#gprs_rpt_topn_et').val(curDate.format("yyyy-MM-dd"));    
    var curTs = curDate.getTime();
    curDate.setTime(curTs - 7*24*3600*1000);
    $('#gprs_rpt_topn_bt').val(curDate.format("yyyy-MM-dd"));	
}

猜你喜欢

转载自blog.csdn.net/ZHOU_VIP/article/details/82957958