源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

JS将秒换成时分秒实现代码

  • 时间:2020-07-31 11:18 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:JS将秒换成时分秒实现代码
[u]复制代码[/u] 代码如下:
function formatSeconds(value) { var theTime = parseInt(value);// 秒 var theTime1 = 0;// 分 var theTime2 = 0;// 小时 // alert(theTime); if(theTime > 60) { theTime1 = parseInt(theTime/60); theTime = parseInt(theTime%60); // alert(theTime1+"-"+theTime); if(theTime1 > 60) { theTime2 = parseInt(theTime1/60); theTime1 = parseInt(theTime1%60); } } var result = ""+parseInt(theTime)+"秒"; if(theTime1 > 0) { result = ""+parseInt(theTime1)+"分"+result; } if(theTime2 > 0) { result = ""+parseInt(theTime2)+"小时"+result; } return result; }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部