当前位置:网站首页>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
边栏推荐
- 2022g2 boiler stoker examination question bank and online simulation examination
- Problem C: Hanoi Tower III
- Visual programming - Experiment 2
- 全新的ORM框架——BeetlSQL介绍
- New ORM framework -- Introduction to beetlsql
- 场景题:A系统如何使用B系统的页面
- 为什么BI对企业这么重要?
- Code forces round # 784 (DIV. 4) solution (First AK CF (XD)
- TCP three handshakes and four waves
- Test questions (2)
猜你喜欢
超好用的Excel异步导出功能
浅学一下I/O流和File类文件操作
2022t elevator repair test simulation 100 questions and online simulation test
MySql关键字GROUP_CONCAT,组合连接查询
2022 团体程序设计天梯赛 模拟赛 L2-3 浪漫侧影 (25 分)
Explanation keyword of MySQL
Unity Basics
Use of ADB command [1]
Why is bi so important to enterprises?
2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
随机推荐
2022年做跨境电商五大技巧小分享
12.<tag-链表和常考点综合>-lt.234-回文链表
Super easy to use [general excel import function]
Queue storage and circular queue
When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director
EasyUI's combobox implements three-level query
Explanation keyword of MySQL
Preview of converting doc and PDF to SWF file
浅学一下I/O流和File类文件操作
移植tslib时ts_setup: No such file or directory、ts_open: No such file or director
QT dynamic translation of Chinese and English languages
2022 团体程序设计天梯赛 模拟赛 L2-1 盲盒包装流水线 (25 分)
. NETCORE sets the API post mode, which can accept parameters directly in parentheses
poi根据数据创建导出excel
关于idea调试模式下启动特别慢的优化
Supersocket is Used in net5 - command
软件测试相关知识~
C set
可以接收多种数据类型参数——可变参数
JS implementation of new