将毫秒转换为“小时:分钟:秒钟”字符串格式

 

 function timeTransform(millisecond:int):String
{

  var hour:int = millisecond / 3600000;
  var minute:int = millisecond / 60000 - hour * 60;
  var second:int = millisecond % 60000 / 1000;

  var hourInfo:String = hour.toString();
  if(hour < 10)
    hourInfo = "0" + hourInfo;

  var minuteInfo:String = minute.toString();
  if(minute < 10)
    minuteInfo = "0" + minuteInfo;

  var secondInfo:String = second.toString();
  if(second < 10)
    secondInfo = "0" + secondInfo;

  return hourInfo +":"+ minuteInfo+ ":" + secondInfo;


}
posted @ 2011-12-28 16:54  居家懒人  阅读(791)  评论(0编辑  收藏  举报