当前位置:网站首页>Calculate the time difference
Calculate the time difference
2022-07-06 16:14:00 【Dream height 1.8 meters】
// deadline:string Closing date
// Calculate how long it will be between now and the deadline
// return:string x God x Hours x branch x second
const computeRemainTime = deadlineTime => {
let r = '';
// How many milliseconds is the difference between the deadline and the current time
let seconds = new Date(deadlineTime).getTime() - new Date().getTime();
// return int
const day = Math.floor(seconds / (24 * 3600 * 1000));
r += day ? day + ' God ' : '';
// Remove the milliseconds of the number of days
seconds = seconds % (24 * 3600 * 1000);
// A few hours left
const hour = Math.floor(seconds / (3600 * 1000));
r += hour ? hour + ' Hours ' : '';
// Remove the milliseconds of the hour
seconds = seconds % (3600 * 1000);
// A few minutes left
const minute = Math.floor(seconds / (60 * 1000));
r += minute ? minute + ' branch ' : '';
// A few seconds left
seconds = seconds % (60 * 1000);
// Remove the milliseconds in minutes
const second = Math.round(seconds / 1000);
r += second ? second + ' second ' : '';
return r;
}
边栏推荐
- C language is the watershed between low-level and high-level
- 浏览器打印边距,默认/无边距,占满1页A4
- Information security - security professional name | CVE | rce | POC | Vul | 0day
- QNetworkAccessManager实现ftp功能总结
- socket通讯
- Essai de pénétration (1) - - outils nécessaires, navigation
- Quick to typescript Guide
- 渗透测试 ( 1 ) --- 必备 工具、导航
- 1323. Maximum number of 6 and 9
- AcWing:第58场周赛
猜你喜欢

969. Pancake sorting

Vs2019 initial use

Penetration test (3) -- Metasploit framework (MSF)

Advancedinstaller安装包自定义操作打开文件

Codeforces Round #799 (Div. 4)A~H

滲透測試 ( 1 ) --- 必備 工具、導航

D - function (HDU - 6546) girls' competition

PySide6 信号、槽

Openwrt build Hello ipk

Information security - Epic vulnerability log4j vulnerability mechanism and preventive measures
随机推荐
Find 3-friendly Integers
2027. Minimum number of operations to convert strings
Opencv learning log 24 -- Hough transform 2 (maximum interval and minimum length can be limited)
875. 爱吃香蕉的珂珂 - 力扣(LeetCode)
Analysis of protobuf format of real-time barrage and historical barrage at station B
Some problems encountered in installing pytorch in windows11 CONDA
Openwrt build Hello ipk
QWidget代码设置样式表探讨
E. Breaking the Wall
JS call camera
HDU - 6024 building shops (girls' competition)
PySide6 信号、槽
If you want to apply for a programmer, your resume should be written like this [essence summary]
Interval sum ----- discretization
1855. Maximum distance of subscript alignment
Problem - 922D、Robot Vacuum Cleaner - Codeforces
[exercise-8] (UVA 246) 10-20-30== simulation
Luogu P1102 A-B number pair (dichotomy, map, double pointer)
The concept of C language array
Hdu-6025-prime sequence (girls' competition)