[Modify]修改小时分钟秒显示

This commit is contained in:
wushaocheng
2022-12-15 15:47:26 +08:00
parent 5a185b07e6
commit a10b544711

View File

@@ -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) {