src/main/java/com/hx/util/DateUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/hx/util/DateUtil.java
@@ -343,4 +343,24 @@ return status; } /**把秒转换成X天X时X分X秒*/ public static String getChineseStr(Integer second) { int day = 24 * 60 * 60; int hour = 60 * 60; int min = 60; int dayNum = second / day; int hourNum = second % day / hour; int minNum = second % day % hour / min; second = second % day % hour % min; String str = dayNum > 0 ? dayNum + "天" : ""; str += hourNum > 0 ? hourNum + "时" : ""; str += minNum > 0 ? minNum + "分" : ""; str += second > 0 ? second + "秒" : ""; return str; } }