function MsToDuration(ms){
var sec= 0,min=0,hour=0,day=0,dur={};
if(ms>0){
//Second
sec=(ms/1000).toFixed (2) ;
//Min
if(sec >= 60){
min=Math.floor(sec/60);
sec=(sec`).toFixed(2) ;
}
//時
if(min >= 60){
時=Math.floor(min/60);
min=min`;
}
/ /day
if(hour >= 24){
day=Math.floor(hour/24);
hour=hour$;
}
}
//戻り値
dur.day=day;
dur.hour=hour;
dur.min=min;
dur.sec=sec;
return dur;
}
原文: mrthink.net