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

边栏推荐
- Topological sorting and graphical display of critical path
- C # character similarity comparison general class
- 2022g2 power station boiler stoker special operation certificate examination question bank and answers
- Introduction to AMBA
- Write a complete answer applet (including single choice questions, judgment questions and multiple topics) (III) single choice questions, judgment questions, and the first question display
- Ping port artifact psping
- 基于单片机的太阳能杀虫系统
- left_ and_ right_ Net interpretable design
- left_and_right_net正常版本
- Simulink and Arduino serial port communication
猜你喜欢
![BUU-Crypto-[HDCTF2019]basic rsa](/img/d0/8e451dabb2a6897f6680220d16d04d.jpg)
BUU-Crypto-[HDCTF2019]basic rsa

一键过滤选择百度网盘文件

【微服务】Nacos集群搭建以及加载文件配置

Online shrimp music will be closed in January next year. Netizens call No

Enterprise level log analysis system elk (if things backfire, there must be other arrangements)

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

ETCD数据库源码分析——初始化总览

2022 a special equipment related management (elevator) examination questions simulation examination platform operation

Introduction To AMBA 简单理解

Input displays the currently selected picture
随机推荐
left_ and_ right_ Net interpretable design
光模块字母含义及参数简称大全
19.Frambuffer应用编程
Arc135 C (the proof is not very clear)
1480. Dynamic sum of one-dimensional array
2022 a special equipment related management (elevator) examination questions simulation examination platform operation
transformer坑了多少算力
【QT】制作MyComboBox点击事件
LC weekly 300
fastjson
2022 t elevator repair operation certificate examination question bank and simulation examination
Supplement the JS of a video website to decrypt the video
Notepad++ -- display related configurations
[paper summary] zero shot semantic segmentation
FreeRTOS 中 RISC-V-Qemu-virt_GCC 的 锁机制 分析
LabVIEW错误对话框的出现
[MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB
2022年A特种设备相关管理(电梯)考试题模拟考试平台操作
tutle时钟改进版
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk