Commit 26ad40c3 authored by yanzg's avatar yanzg

异常处理显示

parent 2b01d763
......@@ -584,6 +584,48 @@ public class DateHelper {
return cal.getTime();
}
/**
* 增加小时处理
*
* @param date 当前日期
* @param hour 需要增加的小时
* @return 增加之后的值
*/
public static Date addHour(Date date, int hour) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.HOUR, hour);
return cal.getTime();
}
/**
* 增加分钟处理
*
* @param date 当前日期
* @param minute 需要增加的分钟
* @return 增加之后的值
*/
public static Date addMinute(Date date, int minute) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MINUTE, minute);
return cal.getTime();
}
/**
* 增加秒处理
*
* @param date 当前日期
* @param second 需要增加的分钟
* @return 增加之后的值
*/
public static Date addSecond(Date date, int second) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MINUTE, second);
return cal.getTime();
}
/**
* 获取当前时间,精准到秒,格式为: yyyy-MM-dd HH:mm:ss
*
......
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