当前位置:网站首页>JS calculation time difference
JS calculation time difference
2022-04-23 19:09:00 【GIS roast lamb leg is delicious】
/* Calculate the interval time difference Time type of start time and end time yyyy-MM-dd HH:mm:ss*/
static timeCHA(starttime, endtime) {
var day1 = new Date(starttime);
var day2 = new Date(endtime);
if (starttime && endtime != "") {
// Count the days
var timediff = day2 - day1;
var days = parseInt(timediff / 86400000);
// Calculate hours
var remain = timediff % 86400000;
var hours = parseInt(remain / 3600000);
// Count the minutes
var remain = remain % 3600000;
var mins = parseInt(remain / 60000);
// Calculate seconds
var remain = remain % 60000;
var ss = parseInt(remain / 1000);
var qx = "";
if (days > 0) {
qx += days + " God ";
}
if (hours > 0) {
qx += hours + " when ";
}
if (mins > 0) {
qx += mins + " branch ";
}
if (ss > 0) {
qx += ss + " second ";
}
}
return qx
}
版权声明
本文为[GIS roast lamb leg is delicious]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231908120794.html
边栏推荐
- 中金财富怎么样?在上边开户安全吗
- 【玩转Lighthouse】腾讯云轻量服务器搭建全平台视频解析视频下载网站
- Esp32 (UART ecoh) - serial port echo worm learning (2)
- [记录]TypeError: this.getOptions is not a function
- mysql通过binlog恢复或回滚数据
- redis优化系列(三)解决主从配置后的常见问题
- Solutions such as unknown or garbled code or certificate problem prompt in Charles's mobile phone packet capture, actual measurement.
- Raspberry pie uses root operation, and the graphical interface uses its own file manager
- mysql_ Download and installation of Linux version
- Practice of Druid SQL and security in meituan review
猜你喜欢
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
One of the reasons why the WebView web page cannot be opened (and some WebView problem records encountered by myself)
MySQL学习第五弹——事务及其操作特性详解
Download xshell 6 and xftp6 official websites
开关电源设计分享及电源设计技巧图解
Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
2022.04.23(LC_763_划分字母区间)
Client interns of a large factory share their experience face to face
Redis optimization series (III) solve common problems after master-slave configuration
WebView opens H5 video and displays gray background or black triangle button. Problem solved
随机推荐
[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born
SSDB Foundation
Go 语言 GUI 框架 fyne 中文乱码或者不显示的问题
Esp32 (UART event) - serial port event learning (1)
js获取本机ip地址
MySQL学习第五弹——事务及其操作特性详解
WebView opens H5 video and displays gray background or black triangle button. Problem solved
static类变量快速入门
openlayers 5.0 当地图容器大小改变时,重新加载地图
ESP32 LVGL8. 1 - msgbox message box (msgbox 28)
在渤海期货办理开户安全吗。
从技术体系到商业洞察,中小研发团队架构实践之收尾篇
Minesweeping II of souI instance
FTP, SSH Remote Access and control
Esp32 (UART 485 communication) - 485 communication of serial port (3)
All table queries and comment description queries of SQL Server
Sentinel rule persistence into Nacos
Client interns of a large factory share their experience face to face
Raspberry pie 18b20 temperature
I just want to leave a note for myself