将毫秒数从十进制转成时间格式,大家帮我看下我哪里出错了,语言是AS3
发布网友
发布时间:2022-05-21 18:17
我来回答
共2个回答
热心网友
时间:2023-11-05 11:53
用这个函数吧,我刚写的
public static function transformFormatDateTime(param1:Number):String
{
var d:Date = new Date();
d.seconds = d.minutes = d.hours = 0;
var n:Number = d.time + param1;
var s:String = String(new Date(n));
return s.split(" ")[3];
}
热心网友
时间:2023-11-05 11:53
private function ShowTime(time:Number):String
{
time = int(time / 10) / 100;
var timeStr:String = time.toString();
var endStr:String = "";
if (timeStr.length - timeStr.indexOf(".") < 3)
endStr = "0";
if (timeStr.indexOf(".") < 0)
endStr = ".00";
if (time < 60)
{
timeStr = timeStr + endStr;
}
else
{
if (time % 60 < 10)
{
timeStr = int(time / 60).toString() +":0" + (int(time*100-int(time / 60) * 60*100)/100).toString() + endStr;
}
else
{
timeStr = int(time / 60).toString() +":" + (int(time*100-int(time / 60) * 60*100)/100).toString() + endStr;
}
}
return timeStr;
}