当前位置:网站首页>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
},
边栏推荐
- 拓扑排序和关键路径的图形化显示
- Simulink与Arduino串口通信
- 配置交叉编译工具链和环境变量
- Online shrimp music will be closed in January next year. Netizens call No
- Google Chrome browser will support the function of selecting text translation
- How much computing power does transformer have
- 【QT】制作MyComboBox点击事件
- Flask
- Integer type of C language
- LC weekly 300
猜你喜欢
RSA加密应用常见缺陷的原理与实践
724. 寻找数组的中心下标
Solar insect killing system based on single chip microcomputer
Graduation design of small programs -- small programs of food and recipes
BUU-Crypto-[GUET-CTF2019]BabyRSA
Accidentally deleted the data file of Clickhouse, can it be restored?
SQL injection - injection based on MSSQL (SQL Server)
补某视频网站的js,进行视频解密
HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
Supplement the JS of a video website to decrypt the video
随机推荐
Ping port artifact psping
Redis realizes ranking function
Flink1.13 basic SQL syntax (II) join operation
left_ and_ right_ Net interpretable design
卸载Google Drive 硬盘-必须退出程序才能卸载
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
Leetcode 184 Employees with the highest wages in the Department (July 3, 2022)
总线的基本概念
Unity2D--人物移动并转身
Design and implementation of tcp/ip series overview
"In simple language programming competition (basic)" part 1 Introduction to language Chapter 3 branch structure programming
Notepad++--显示相关的配置
[QT] create mycombobox click event
C language simple student management system (including source code)
The data mark is a piece of fat meat, and it is not only China Manfu technology that focuses on this meat
left_and_right_net可解释性设计
left_and_right_net正常版本
2022 question bank and answers for safety management personnel of hazardous chemical business units
LC周赛300
Graduation design of small programs -- small programs of food and recipes