|
|
|
@ -59,7 +59,7 @@ public class DateUtils { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 指定日期的前后几天 |
|
|
|
* 指定日期的前后几天 工作日 |
|
|
|
* @param oneday 特定日期 |
|
|
|
* @param amount 天数 前几天参数amount为负整数 |
|
|
|
* @return |
|
|
|
@ -67,6 +67,15 @@ public class DateUtils { |
|
|
|
public static Date daysAgoOrAfter(Date oneday,int amount){ |
|
|
|
Calendar mon = Calendar.getInstance(); |
|
|
|
mon.setTime(oneday); |
|
|
|
// 逢周六周日,日期延后一天
|
|
|
|
for (int i = 0; i < amount; i++) { |
|
|
|
mon.set(Calendar.DATE, mon.get(Calendar.DATE) + 1); |
|
|
|
if (Calendar.SATURDAY == mon.get(Calendar.SATURDAY) || Calendar.SUNDAY == mon.get(Calendar.SUNDAY)) { |
|
|
|
amount = amount + 1; |
|
|
|
mon.set(Calendar.DATE, mon.get(Calendar.DATE) + 1); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
mon.add(Calendar.DATE,amount); |
|
|
|
return mon.getTime(); |
|
|
|
} |
|
|
|
|