From 63b0b03d19d543dde86edd2e451a198378ec5463 Mon Sep 17 00:00:00 2001 From: E1ED922C1E9526DD63272D7EC5C6CB77 <E1ED922C1E9526DD63272D7EC5C6CB77@i-search.com.cn> Date: 星期三, 04 十一月 2020 10:35:55 +0800 Subject: [PATCH] 添加秒转中文时间字符串 --- src/main/java/com/hx/util/DateUtil.java | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hx/util/DateUtil.java b/src/main/java/com/hx/util/DateUtil.java index f06d7eb..9d1cf97 100644 --- a/src/main/java/com/hx/util/DateUtil.java +++ b/src/main/java/com/hx/util/DateUtil.java @@ -343,4 +343,24 @@ return status; } + /**鎶婄杞崲鎴怷澶鏃禭鍒哫绉�*/ + 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; + } + } -- Gitblit v1.8.0