当前位置:网站首页>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
},

边栏推荐
- ANSYS command
- 2022年R2移动式压力容器充装复训题库及答案
- Notepad++ -- display related configurations
- Design and implementation of tcp/ip series overview
- 【微服务】Nacos集群搭建以及加载文件配置
- 2022 a special equipment related management (elevator) examination questions simulation examination platform operation
- js获取对象中嵌套的属性值
- VB.net 调用FFmpeg简单处理视频(类库——6)
- Introduction To AMBA 简单理解
- Kubernets first meeting
猜你喜欢

509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费

空洞卷积、可变形卷积、可变形ROI Pooling

Google Chrome browser will support the function of selecting text translation

LM small programmable controller software (based on CoDeSys) note XXI: error 3703

Ping port artifact psping

2022 question bank and answers for safety management personnel of hazardous chemical business units

Analysis of classical pointer and array written test questions in C language

Simulink与Arduino串口通信

Upper computer software development - log information is stored in the database based on log4net

Solar insect killing system based on single chip microcomputer
随机推荐
19.Frambuffer应用编程
Upper computer software development - log information is stored in the database based on log4net
input显示当前选择的图片
px em rem的区别
509. 斐波那契数、爬楼梯所有路径、爬楼梯最小花费
VB. Net GIF (making and disassembling - optimizing code, class library - 5)
LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052
BUU-Crypto-[GUET-CTF2019]BabyRSA
BUU-Crypto-[HDCTF2019]basic rsa
数据标注是一块肥肉,盯上这块肉的不止中国丨曼孚科技
光模塊字母含義及參數簡稱大全
BUU-Crypto-Cipher
What are the reasons for the frequent high CPU of ECS?
如何获取el-tree中所有节点的父节点
Take you to quickly learn how to use qsort and simulate qsort
left_ and_ right_ Net normal version
Analysis of classical pointer and array written test questions in C language
ANSYS command
724. Find the central subscript of the array
(4) Canal multi instance use