当前位置:网站首页>JS how to convert seconds into hours, minutes and seconds display
JS how to convert seconds into hours, minutes and seconds display
2022-07-04 05:42:00 【_ Virgo programmer's daily life】
When we count down, the back end often returns *** second , You need the front-end to display itself on the page in hours, minutes and seconds . How to convert ?
// Written in mouned in :
let time = this.secTotime(61);
console.log(" Convert to minutes and seconds yes ",time);
// methods:
secTotime(s) {
var t = '';
if(s > -1){
var hour = Math.floor(s/3600)
var min = Math.floor(s/60) % 60
var sec = s % 60
if(hour < 10) {
t = '0'+ hour + ":"
} else {
t = hour + ":"
}
if(min < 10){
t += "0"
}
t += min + ":"
if(sec < 10){
t += "0"
}
t += sec.toFixed(0)
}
return t
},

边栏推荐
- Flink1.13 SQL basic syntax (I) DDL, DML
- BUU-Crypto-[GUET-CTF2019]BabyRSA
- Accidentally deleted the data file of Clickhouse, can it be restored?
- Arc135 C (the proof is not very clear)
- el-select如何实现懒加载(带搜索功能)
- FreeRTOS 中 RISC-V-Qemu-virt_GCC 的 锁机制 分析
- Halcon图片标定,使得后续图片处理过后变成与模板图片一样
- ansys命令
- Wechat applet +php realizes authorized login
- 光模块字母含义及参数简称大全
猜你喜欢

LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052

如何展开Collapse 的所有折叠面板

Ping port artifact psping

2022年R2移动式压力容器充装复训题库及答案

LM small programmable controller software (based on CoDeSys) note XXI: error 3703
![[excel] PivotChart](/img/45/be87e4428a1d8ef66ef34a63d12fd4.png)
[excel] PivotChart
![[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)](/img/78/63ab1a8bb1b6e256cc740f3febe711.jpg)
[wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)

LabVIEW错误对话框的出现

What are the reasons for the frequent high CPU of ECS?

BUU-Pwn-test_ your_ nc
随机推荐
js arguments参数使用和详解
XII Golang others
简易零钱通
LM小型可编程控制器软件(基于CoDeSys)笔记二十一:错误3703
Evolution of system architecture: differences and connections between SOA and microservice architecture
js如何将秒转换成时分秒显示
C # character similarity comparison general class
Excel 比较日器
2022 a special equipment related management (elevator) examination questions simulation examination platform operation
19. Framebuffer application programming
[paper summary] zero shot semantic segmentation
LM small programmable controller software (based on CoDeSys) note XXI: error 3703
"In simple language programming competition (basic)" part 1 Introduction to language Chapter 3 branch structure programming
Overview of relevant subclasses of beanfactorypostprocessor and beanpostprocessor
Use of hutool Pinyin tool
光模块字母含义及参数简称大全
【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块
总线的基本概念
SQL performance optimization skills
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk