/** * 将秒数转换为基于00:00的时间 * 如541=9*60+1,表示09:01 * @param minutes * @return */ public static String getTimeByMinutes(int minutes){ //处理小时 int hour = minutes / 60; String hourTime = ""; if(hour >= 0 && hour < 10){ hourTime = "0" + hour;// 1 --> 01 }else if(hour >= 10 && hour < 24){ hourTime = "" + hour; }else if(hour >= 24){ hourTime = "0" + (hour-24); } //处理分钟 int min = minutes % 60; String minTime = ""; if(min >= 0 && min < 10){ minTime = "0" + min;// 1 --> 01 }else{ minTime = "" + min; } return hourTime + ":" + minTime; }
时间: 2024-11-09 00:12:13