android 秒转当日时分、分钟转当日时分工具类
- 作者:
- 发表时间:2020-02-17 21:59
- 来源:未知
// 分钟转 当日时分 格式00:00 public static String secToTime(int minute) { String returnStr = null; int hour = 0; if (minute <= 0) return "00:00"; else { if (minute < 60) { returnStr = "00:"+timeFormat(time); } else { hour = minute / 60; if (hour >= 24) return "24:00"; minute = minute % 60; returnStr = timeFormat(hour) +":"+ timeFormat(minute) ; } } return returnStr; }
public static String timeFormat(int i) { String returnStr = null; if (i >= 0 && i < 10) returnStr = "0"+Integer.toString(i); else returnStr = "" + i; return returnStr; }