1 <!--得出一个永远不会重复的日期格式的字符串,包括毫秒,用于AJAX输出一个不重复参数,以避免不刷新,function全部写在head节点内--> 2 <script type="text/javascript"> 3 function getNowTime() { 4 var date = new Date(); 5 this.year = date.getFullYear(); 6 this.month = date.getMonth() + 1; 7 this.date = date.getDate(); 8 this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); 9 this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); 10 this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); 11 this.milliSeconds = date.getMilliseconds(); 12 var currentTime = this.year + '-' + this.month + '-' + this.date + ' ' + this.hour + ':' + this.minute + ':' + this.second + '.' + this.milliSeconds; 13 return currentTime; 14 } 15 </script>
标签:10,getMinutes,getSeconds,getHours,代码,js,date,month From: https://www.cnblogs.com/automationanywhere/p/17295877.html