修复时间展示双位数前会多0问题

This commit is contained in:
tanghao
2018-12-26 19:18:22 +08:00
parent 3e5404349c
commit 200de1eb04

View File

@@ -382,7 +382,7 @@ function showBandwidthChart(id,unitType,xdata,ydata,title){
var chooseDate=new Date($('#beginDate').val());
chooseDate=chooseDate.setDate(chooseDate.getDate()+1);
var modifyTime=new Date(chooseDate);
$('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>10?modifyTime.getSeconds():'0'+modifyTime.getSeconds()));
$('#endDate').val(modifyTime.getFullYear()+"-"+((modifyTime.getMonth()+1)>=10?(modifyTime.getMonth()+1):"0"+(modifyTime.getMonth()+1))+"-"+(modifyTime.getDate()>=10?modifyTime.getDate():'0'+modifyTime.getDate())+' '+(modifyTime.getHours()>=10?modifyTime.getHours():'0'+modifyTime.getHours())+':'+(modifyTime.getMinutes()>=10?modifyTime.getMinutes():'0'+modifyTime.getMinutes())+':'+(modifyTime.getSeconds()>=10?modifyTime.getSeconds():'0'+modifyTime.getSeconds()));
}
</script>
</body>