Displaying Interval of Time in JavaScript
2009-08-31 22:42
441 查看
Today I searched on the Internet how to figure out how much time did it take to execute my query task in a bqy, but couldn't find anything great to fulfil/meet my need. Then I learnt it from my predecessor's codes. Now I want to write it down so that one day when I go back to read the articles I can remember them:
//取整 m除以n所得结果的整数部分 function getDevInt(m,n) { if(n==0) return m else { var rtn = ((m-(m%n))/n) return rtn } } //根据毫秒数,得出时,分,秒数 function getExecTime(itime) { var rtn = " " var hours = getDevInt(itime,60*60*1000) itime = itime - hours*60*60*1000 var minutes = getDevInt(itime,60*1000) itime = itime - minutes*60*1000 var seconds = getDevInt(itime,1000) rtn = rtn + hours + "小时" +minutes + "分钟" +seconds+"秒" return rtn } //查询起始时间 var l_start_time = new Date() //查询结束时间 var l_end_time = new Date() var l_proc_time = getExecTime(l_end_time.getTime()-l_start_time.getTime()) //将耗时填充到首页的控件text_proc_time l_eis_section.Shapes["text_proc_time"].Text = "查询耗时:"+l_proc_time
相关文章推荐
- javascript中in,of
- JavaScript "typeof" and "in"
- 【拿来主义】WebAssembly - JavaScript Just-in-time (JIT) 工作原理
- Fatal error: Maximum execution time of 30 seconds exceeded in
- Time complexity of ArrayList in Java
- The return value of "mktime" in different time zone
- The Program of Algorithms ------- Sorting in Linear Time---- Counting Sort
- addTimeInterval Deprecated in iOS 4.0
- Maximum execution time of 30 seconds exceed in db_sql.php on line......
- Displaying a Sorted, Paged, and Filtered Grid of Data in ASP.NET MVC
- 安装 Fatal error: Maximum execution time of 30 seconds exceeded in …/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 230
- time synchronization in html page with javascript
- Time, Clocks, and the Ordering of Events in a Distributed System
- 译《Time, Clocks, and the Ordering of Events in a Distributed System》
- Get the content of an Iframe in Javascript – crossbrowser solution for both IE and Firefox
- javascript--hasOwnProperty()+isPrototypeof()+in方法
- php Fatal error: Maximum execution time of 30 seconds exceeded in 问题的解决方案
- Accessing List Data using the JavaScript Client OM and displaying in a Dialog
- Maximum execution time of 0 seconds exceeded in
- Set Font Properties On Mouse Hover Of Push Button And Text Items At Run time In Oracle Forms