Commit a2463789 authored by 张永's avatar 张永
parents 33051cde 1da43d04
......@@ -254,17 +254,26 @@ public class DateUtil {
*/
public static String format(Integer time, String fmt) {
if (time != null) {
if (time < 86400000) {
Integer dayCount = 0;
while(time >= 86400000) {
time -= 86400000;
dayCount += 1;
}
if(dayCount > 0) {
return "大于" + dayCount + "天";
} else {
Date date = new Date(time - (1000 * 60 * 60 * 8));
SimpleDateFormat sdf = new SimpleDateFormat(fmt);
return sdf.format(date);
} else {
throw new RuntimeException("Can't greater than 86400000");
}
} else {
return null;
}
}
public static void main(String[] args) {
System.out.println(format(Integer.MAX_VALUE));
}
/**
* 计算指定时间当天的开始时间
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment