/*
* transform the time from the int(0) form to the string("00:00") form
* @param {int} unformTime:the int form time
* @return {string} formedTime:the string form time("00:00")
*/
//need to be checked(efficiency)
function transformTime(unformedTime) {
var formedTime = "";
if (isNaN(unformedTime) || (unformedTime == Infinity) || (unformedTime<0)) {
formedTime = "00:00"
} else {
var minutes = Math.floor(unformedTime / 60);
if (minutes < 10) {
minutes = "0" + minutes;
}
var seconds = Math.floor(unformedTime - minutes * 60);
if (seconds < 10) {
seconds = "0" + seconds;
}
formedTime = minutes + ":" + seconds;
}
return formedTime;
}
俗语道,自己动手,丰衣足食。