当前位置:网站首页>js 计算时间差
js 计算时间差
2022-04-23 19:08:00 【Gis烤羊腿真好吃】
/*计算相隔时间差 开始时间和结束时间的时间类型 yyyy-MM-dd HH:mm:ss*/
static timeCHA(starttime, endtime) {
var day1 = new Date(starttime);
var day2 = new Date(endtime);
if (starttime && endtime != "") {
//计算天数
var timediff = day2 - day1;
var days = parseInt(timediff / 86400000);
//计算小时数
var remain = timediff % 86400000;
var hours = parseInt(remain / 3600000);
//计算分钟数
var remain = remain % 3600000;
var mins = parseInt(remain / 60000);
//计算秒
var remain = remain % 60000;
var ss = parseInt(remain / 1000);
var qx = "";
if (days > 0) {
qx += days + "天";
}
if (hours > 0) {
qx += hours + "时";
}
if (mins > 0) {
qx += mins + "分";
}
if (ss > 0) {
qx += ss + "秒";
}
}
return qx
}
版权声明
本文为[Gis烤羊腿真好吃]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_38190600/article/details/102488331
边栏推荐
- On the forced conversion of C language pointer
- Advanced transfer learning
- Xlslib use
- Sentinel service fusing practice (sentinel integration ribbon + openfeign + fallback)
- SSDB基础3
- Screen right-click menu in souI
- Dynamically add and delete layouts
- 特征选择feature_selection--SelectKBest
- 開關電源設計分享及電源設計技巧圖解
- Zlib realizes streaming decompression
猜你喜欢

Chondroitin sulfate in vitreous

ESP32 LVGL8. 1 - roller rolling (roller 24)

MVVM模型

Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)

After opening the original normal project, the dependency package displays red and does not exist.

Android Development: the client obtains the latest value in the database in real time and displays it on the interface

ESP32 LVGL8. 1. Detailed migration tutorial of m5stack + lvgl + IDF (27)

FTP, SSH Remote Access and control

Esp32 (UART ecoh) - serial port echo worm learning (2)

为何PostgreSQL即将超越SQL Server?
随机推荐
Simple use of navigation in jetpack
Raspberry pie uses root operation, and the graphical interface uses its own file manager
Esp32 (UART event) - serial port event learning (1)
Is it safe to open an account in Bohai futures.
【历史上的今天】4 月 23 日:YouTube 上传第一个视频;网易云音乐正式上线;数字音频播放器的发明者出生
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
Wechat video extraction and receiving file path
MySQL学习第五弹——事务及其操作特性详解
SSDB基础
Treatment of incomplete display of listview height
腾讯云GPU最佳实践-使用jupyter pycharm远程开发训练
高层次人才一站式服务平台开发 人才综合服务平台系统
Redis common interview questions
Implementation of TCP UDP communication with golang language
mysql_ Download and installation of Linux version
剑指 Offer II 116. 省份数量-空间复杂度O(n),时间复杂度O(n)
ESP32 LVGL8. 1 - roller rolling (roller 24)
【C语言进阶11——字符和字符串函数及其模拟实现(2))】
Client interns of a large factory share their experience face to face
2022.04.23 (lc_763_divided into letter interval)