首頁  >  文章  >  web前端  >  JS將秒換成時分秒實現程式碼_javascript技巧

JS將秒換成時分秒實現程式碼_javascript技巧

WBOY
WBOY原創
2016-05-16 17:23:351343瀏覽
複製程式碼 程式碼如下:

function formatSeconds(value) {
var the = Intse] );// 秒
var theTime1 = 0;// 分
var theTime2 = 0;// 小時
// alert(theTime);
if(theTime > 60) {
theTime1 = parseInt(theTime/60);
theTime = parseInt(theTime`);
// alert(theTime1 "-" theTime);
if(theTime1 > 60) {
theTime2 = parseIntse (theTime1/60);
theTime1 = parseInt(theTime1`);
}
}
var result = "" parseInt(theTime) "秒";
if(theTime1 > 0) {
result = "" parseInt(theTime1) "分" result;
}
if(theTime2 > 0) {
result = "" parseInt(theTime2) "小時" result;
result = "" parseInt(theTime2) "小時" result; }
return result;
}
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn