1.控件,获取第一个input中的时间,再将这个时间的前一天赋值给第二个input

<input type="text" class="form-control input-sm"  />

<input type="text" class="form-control input-sm" />

2.JS

function changeData(){
    var curTime = $dp.cal.getNewDateStr();//获取当前控件的日期
    curTime = curTime.replace(/-/g,"/");
    var date = new Date(curTime);//将当前的日期转换成系统格式的日期
    var preDate = new Date(date.getTime() - 24*60*60*1000); //前一天
    var copyTime = preDate.getFullYear()+"-"+(preDate.getMonth()+1).toString()+"-"+ preDate.getDate().toString()+" "+"23:30";//拼接前一天日期为xxxx-xx-xx 23:30
    $("#backupsTime").val(copyTime);
}

 

  

相关文章:

  • 2021-09-03
  • 2021-12-18
  • 2021-07-06
  • 2021-11-28
  • 2022-12-23
  • 2021-07-11
  • 2022-12-23
  • 2021-10-11
猜你喜欢
  • 2021-10-17
  • 2021-08-01
  • 2021-06-03
  • 2021-10-25
  • 2022-01-04
  • 2021-12-27
相关资源
相似解决方案