ArrayList<Integer> holidays = ...
只需在您的
if条件中添加条件
do-while:
do { startCal.add(Calendar.DAY_OF_MONTH, 1); if (startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY && startCal.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY && !holidays.contains((Integer) startCal.get(Calendar.DAY_OF_YEAR))) { ++workDays; }} while (startCal.getTimeInMillis() < endCal.getTimeInMillis());
为简单起见,我假设
holiday包含的日期格式与相同
Calendar.DAY_OF_YEAR。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)