当前位置:网站首页>JS calculates the display date according to the time
JS calculates the display date according to the time
2022-04-23 03:26:00 【Open the door of the world】
getTime() {
getTime(
'',
(res) => {
console.log(' system time ', res.data.data.time_now)
this.nowTime = res.data.data.time_now
this.orderData.forEach((val, index) => {
let newTime = (val.expire_time - this.nowTime) * 1000
console.log('newTime', newTime)
let days = Math.floor(newTime / (24 * 3600 * 1000)) // Calculate the number of days
let leavel = newTime % (24 * 3600 * 1000) // Time remaining after calculating days
let hours = Math.floor(leavel / (3600 * 1000)) // Count the remaining hours
let leavel2 = leavel % (3600 * 1000) // Calculate the number of milliseconds remaining after the remaining hours
let minutes = Math.floor(leavel2 / (60 * 1000)) // Count the minutes left
if (days === 0) {
var tt = `${
hours} Hours ${
minutes} minute `
} else if (hours === 0) {
var tt = `${
minutes} minute `
} else {
var tt = `${
days} God ${
hours} Hours ${
minutes} minute `
}
this.$set(this.orderData[index], 'tt', tt)
})
},
(err) => {
console.log('err', err)
}
)
console.log('orderData', this.orderData)
},
版权声明
本文为[Open the door of the world]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220619451567.html
边栏推荐
- 《C语言程序设计》(谭浩强第五版) 第7章 用函数实现模块化程序设计 习题解析与答案
- Problem C: Hanoi Tower III
- Comprehensive calculation of employee information
- Optimization of especially slow startup in idea debugging mode
- JS recursive tree structure calculates the number of leaf nodes of each node and outputs it
- Test questions (2)
- Learn about I / O flow and file operations
- socket編程 send()與 recv()函數詳解
- 2022 团体程序设计天梯赛 模拟赛 L2-3 浪漫侧影 (25 分)
- Flink customizes the application of sink side sinkfunction
猜你喜欢
![General testing technology [1] classification of testing](/img/f1/d80b6793b6443cbc4048d7e6319f51.png)
General testing technology [1] classification of testing

Unity games and related interview questions

Comprehensive calculation of employee information

When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director

File upload vulnerability summary and upload labs shooting range documentary

Supersocket is Used in net5 - command

Supersocket is Use in net5 - concept

Unity knowledge points (common core classes)

2022a special equipment related management (elevator) work license question bank and simulation examination

2022 团体程序设计天梯赛 模拟赛 L2-3 浪漫侧影 (25 分)
随机推荐
Detailed explanation of socket programming send() and recv() functions
Node configuration environment CMD does not take effect
Talent Plan 学习营初体验:交流+坚持 开源协作课程学习的不二路径
General test technology [II] test method
[vs Code] solve the problem that the jupyter file displays exceptions in vs code
Unity Basics
. net webapi access authorization mechanism and process design (header token + redis)
Codeforces Round #784 (Div. 4)題解 (第一次AK cf (XD
MySQL grouping query rules
Is it difficult to choose binary version control tools? After reading this article, you will find the answer
Eight elder brothers chronicle [4]
Unity knowledge points (ugui)
Query stored procedures in PostgreSQL
TCP three handshakes and four waves
Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions
MySql关键字GROUP_CONCAT,组合连接查询
General testing technology [1] classification of testing
Visual programming - Experiment 1
Course design of Database Principle -- material distribution management system
第四次作业