SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String source="2012-12-8";
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(source)); //写入日期
Calendar c = (Calendar) cal.clone(); // 克隆一份日期
c.add(Calendar.MONTH, 3); // 在克隆日期上加三个月
while(!c.before(cal)) //档cal日期大于c日期时就终止
{
int day = cal.get(Calendar.DAY_OF_WEEK); // 获取星期几
if( day == Calendar.MONDAY || day == Calendar.WEDNESDAY || day == Calendar.FRIDAY || day == Calendar.SUNDAY){
System.out.println(sdf.format(cal.getTime()));
}
cal.add(Calendar.DATE, 1); //对日期天数加1
}
}
String source="2012-12-8";
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(source)); //写入日期
Calendar c = (Calendar) cal.clone(); // 克隆一份日期
c.add(Calendar.MONTH, 3); // 在克隆日期上加三个月
while(!c.before(cal)) //档cal日期大于c日期时就终止
{
int day = cal.get(Calendar.DAY_OF_WEEK); // 获取星期几
if( day == Calendar.MONDAY || day == Calendar.WEDNESDAY || day == Calendar.FRIDAY || day == Calendar.SUNDAY){
System.out.println(sdf.format(cal.getTime()));
}
cal.add(Calendar.DATE, 1); //对日期天数加1
}
}