mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
DateUtil增加offsetYear方法
This commit is contained in:
parent
245d8c5e95
commit
0d0727d0f9
@ -1197,6 +1197,17 @@ public class DateUtil extends CalendarUtil {
|
||||
return offset(date, DateField.MONTH, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 偏移年
|
||||
*
|
||||
* @param date 日期
|
||||
* @param offset 偏移年数,正数向未来偏移,负数向历史偏移
|
||||
* @return 偏移后的日期
|
||||
*/
|
||||
public static DateTime offsetYear(final Date date, final int offset) {
|
||||
return offset(date, DateField.YEAR, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定日期偏移指定时间后的时间,生成的偏移日期不影响原日期
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user