[Modify]修改小时分钟秒显示
This commit is contained in:
@@ -403,20 +403,29 @@ public class TimeUtils {
|
||||
sencond = time % 60;
|
||||
}
|
||||
}
|
||||
return (hour<10?("0"+hour):hour) + ":" + (minutes<10?("0"+minutes):minutes) + ":" + (sencond<10?("0"+sencond):sencond);
|
||||
return (hour < 10 ? ("0" + hour) : hour) + ":" + (minutes < 10 ? ("0" + minutes) : minutes) + ":" + (sencond < 10 ? ("0" + sencond) : sencond);
|
||||
}
|
||||
|
||||
public static String secondsToTime(long seconds){
|
||||
long h=seconds/3600; //小时
|
||||
long m=(seconds%3600)/60; //分钟
|
||||
long s=(seconds%3600)%60; //秒
|
||||
if(h>0){
|
||||
return h+"小時"+m+"分鐘"+s+"秒";
|
||||
public static String
|
||||
secondsToTime(long seconds) {
|
||||
long h = seconds / 3600; //小时
|
||||
long m = (seconds % 3600) / 60; //分钟
|
||||
long s = (seconds % 3600) % 60; //秒
|
||||
if (h > 0) {
|
||||
if(m== 0 && s == 0){
|
||||
return h + "小時";
|
||||
}else {
|
||||
return h + "小時" + m + "分鐘" + s + "秒";
|
||||
}
|
||||
}
|
||||
if(m>0){
|
||||
return m+"分鐘"+s+"秒";
|
||||
if (m > 0) {
|
||||
if(s == 0){
|
||||
return m + "分鐘";
|
||||
}else {
|
||||
return m + "分鐘" + s + "秒";
|
||||
}
|
||||
}
|
||||
return s+"秒";
|
||||
return s + "秒";
|
||||
}
|
||||
|
||||
public static String getChineseMonth(Context context, long millis) {
|
||||
|
Reference in New Issue
Block a user