33 lines
776 B
Java
33 lines
776 B
Java
package com.zhgd.xmgl.util;
|
|
|
|
public class TimeUtil {
|
|
/**
|
|
* 获取时分秒中文显示
|
|
*
|
|
* @param second
|
|
* @return
|
|
*/
|
|
public static String toHourMinSecond(Integer second) {
|
|
if (second == null) {
|
|
return null;
|
|
}
|
|
int h = second / 3600;
|
|
int min = (second % 3600) / 60;
|
|
int s = (second % 3600) % 60;
|
|
String rs = "";
|
|
if (second >= 3600) {
|
|
rs = h + "h";
|
|
}
|
|
if (second >= 60) {
|
|
rs += min + "min";
|
|
}
|
|
return rs + s + "s";
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(toHourMinSecond(1));
|
|
System.out.println(toHourMinSecond(70));
|
|
System.out.println(toHourMinSecond(1000));
|
|
}
|
|
}
|