日期:2014-05-20  浏览次数:20725 次

请教高手 :如何的到某一月的第三个星期三的日期????
请教高手   :如何的到某一月的第三个星期三的日期????

------解决方案--------------------
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.set(Calendar.MONTH,某月的月份);//注意这个月份是从0开始的
cal.set(Calendar.WEEK_OF_MONTH,3);
cal.set(Calendar.DAY_OF_WEEK,Calendar.WEDNESDAY);
cal.getTime();//这个应该就是你要的日期了
------解决方案--------------------
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.set(Calendar.YEAR,2007);//2007 current year
c.set(Calendar.MONTH,(4-1));//4 current month
c.set(Calendar.DATE,1);
c.set(Calendar.WEEK_OF_MONTH,
c.get(Calendar.DAY_OF_WEEK)> Calendar.WEDNESDAY?4:3);
c.set(Calendar.DAY_OF_WEEK,Calendar.WEDNESDAY);
c.getTime();

System.out.println(c.getTime());