|
@@ -151,6 +151,31 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
|
|
return DateFormatUtils.format(date, patternStr);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 将秒转为时分秒格式【01:01:01】
|
|
|
+ * @param second 需要转化的秒数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String secondConvertHourMinSecond(Long second) {
|
|
|
+ String str = "";
|
|
|
+ if (second == null || second < 0) {
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 得到小时
|
|
|
+ long h = second / 3600;
|
|
|
+ str = h > 0 ? ((h < 10 ? ("0" + h) : h) + "时") : "";
|
|
|
+
|
|
|
+ // 得到分钟
|
|
|
+ long m = (second % 3600) / 60;
|
|
|
+ str += m > 0? (m < 10 ? ("0" + m) : m) + "分":"";
|
|
|
+
|
|
|
+ //得到剩余秒
|
|
|
+ long s = second % 60;
|
|
|
+ str += s > 0?(s < 10 ? ("0" + s) : s)+"秒":"";
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+
|
|
|
public static String timestampToDate(Long times){
|
|
|
if(Validator.isEmpty(times)){
|
|
|
return "";
|