您的位置:首页 > 其它

时间转化从毫秒转化成--->xx(分):xx(秒):xx(未)

2011-05-05 11:03 387 查看
计时游戏中常用到时间转换方法:

public String timeTransform(float time){
float second=(time/(float)1000);//秒
float s=Math.round(second*100)/(float)100;//小数点后带两位数的秒
int a=((int)(s*100))%100;
int b=(int)s%60;
int c=(int)s/60;

String strA=""+a;
String strB=""+b;
String strC=""+c;
if(a<10){
strA="0"+a;
}
if(b<10){
strB="0"+b;
}
if(c<10){
strC="0"+c;
}
return (strC+":"+strB+":"+strA);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: