当前位置:网站首页>JS converts seconds to "2h30min50s" format
JS converts seconds to "2h30min50s" format
2022-06-29 18:37:00 【bidepanm】
formatSeconds(value) {
let theTime = parseInt(value);// The time required for conversion is seconds
let theTime1 = 0;// branch
let theTime2 = 0;// Hours
let theTime3 = 0;// God
if(theTime > 60) {
theTime1 = parseInt(theTime/60);
theTime = parseInt(theTime%60);
if(theTime1 > 60) {
theTime2 = parseInt(theTime1/60);
theTime1 = parseInt(theTime1%60);
if(theTime2 > 24){
// Greater than 24 Hours
theTime3 = parseInt(theTime2/24);
theTime2 = parseInt(theTime2%24);
}
}
}
let result = '';
if(theTime > 0){
result = ""+parseInt(theTime)+"s";
}
if(theTime1 > 0) {
result = ""+parseInt(theTime1)+"min"+result;
}
if(theTime2 > 0) {
result = ""+parseInt(theTime2)+"h"+result;
}
if(theTime3 > 0) {
result = ""+parseInt(theTime3)+"day"+result;
}
return result;
}
边栏推荐
- 报错[warning] Neural network inference was performed on socket ‘RGB’, depth frame is aligned to socket
- Sister Juan takes you to learn database -- 5-day dash day4
- VMware安装ESXI
- WBF:检测任务NMS后虑框新方式?
- SD6.24集训总结
- JDBC knowledge
- Sd6.22 summary of intensive training
- Adobe Premiere基础-炫酷文字快闪(十四)
- Sd6.25 summary of intensive training
- 面霸篇:MySQL六十六问,两万字+五十图详解!
猜你喜欢

Adobe Premiere基础-炫酷文字快闪(十四)

Know that Chuangyu has helped the energy industry in asset management and was selected into the 2021 IOT demonstration project of the Ministry of industry and information technology

Adobe Premiere foundation - material nesting (animation of Tiktok ending avatar) (IX)

第八届“互联网+”大赛 | 云原生赛道邀你来挑战

关于微服务

jdbc_相關代碼

Sword finger offer 34 Path DFS method for binary tree neutralization

《安富莱嵌入式周报》第271期:2022.06.20--2022.06.26

Adobe Premiere基础-不透明度(蒙版)(十一)

源码安装MAVROS
随机推荐
How do I add SmartArt to slides in PowerPoint?
【网络是怎么连接的】第三章 探索集线器,交换机和路由器
Us judge ruled that the former security director of Uber accused of covering up hacking must face fraud charges
Request header field xxxx is not allowed by Access-Control-Allow-Headers in preflight response问题
Adobe Premiere基础-素材嵌套(制作抖音结尾头像动画)(九)
Adobe Premiere基础-不透明度(蒙版)(十一)
WBF:检测任务NMS后虑框新方式?
JWT login authentication
【TcaplusDB知识库】TcaplusDB运维单据介绍
SD6.23集训总结
VMware安装ESXI
MySql存储过程循环的使用分析详解
Shell basic syntax -- process control
[how the network is connected] Chapter 3 explores hubs, switches and routers
Adobe Premiere基础-声音调整(音量矫正,降噪,电话音,音高换挡器,参数均衡器)(十八)
Adobe Premiere Basics - general operations for editing material files (offline files, replacing materials, material labels and grouping, material enabling, convenient adjustment of opacity, project pa
Goldfish rhca memoirs: do447 build advanced job workflow -- create job template survey to set work variables
Markdown knowledge comes gently
JDBC knowledge
《安富莱嵌入式周报》第271期:2022.06.20--2022.06.26