|
|
@ -67,16 +67,19 @@ public class DateUtils { |
|
|
public static Date daysAgoOrAfter(Date oneday,int amount){ |
|
|
public static Date daysAgoOrAfter(Date oneday,int amount){ |
|
|
Calendar mon = Calendar.getInstance(); |
|
|
Calendar mon = Calendar.getInstance(); |
|
|
mon.setTime(oneday); |
|
|
mon.setTime(oneday); |
|
|
|
|
|
//如果今天是周六或周日
|
|
|
|
|
|
if (Calendar.SATURDAY == mon.get(Calendar.SATURDAY) || Calendar.SUNDAY == mon.get(Calendar.SUNDAY)) { |
|
|
|
|
|
amount=amount+1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 逢周六周日,日期延后一天
|
|
|
// 逢周六周日,日期延后一天
|
|
|
for (int i = 0; i < amount; i++) { |
|
|
for (int i = 0; i < amount; i++) { |
|
|
mon.set(Calendar.DATE, mon.get(Calendar.DATE) + 1); |
|
|
mon.set(Calendar.DATE, mon.get(Calendar.DATE) + 1); |
|
|
if (Calendar.SATURDAY == mon.get(Calendar.SATURDAY) || Calendar.SUNDAY == mon.get(Calendar.SUNDAY)) { |
|
|
if (Calendar.SATURDAY == mon.get(Calendar.SATURDAY) || Calendar.SUNDAY == mon.get(Calendar.SUNDAY)) { |
|
|
amount = amount + 1; |
|
|
amount++; |
|
|
mon.set(Calendar.DATE, mon.get(Calendar.DATE) + 1); |
|
|
|
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
mon.add(Calendar.DATE,amount); |
|
|
|
|
|
return mon.getTime(); |
|
|
return mon.getTime(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|