2013年9月22日星期日

Time calculation , please enlighten me

Enlighten me :

such date 2013-06

I want to calculate a few weeks in June , and the weekly Monday to Sunday were a few numbers .

Thank you.




------ Solution ------------------------------------ --------

Calendar cal = Calendar.getInstance();
DateFormat sf = new SimpleDateFormat("yyyy-MM-dd E F");
cal.set(Calendar.YEAR, 2013);
cal.set(Calendar.MONTH, 5);

for(int i = 1 ;i <= 30;i++){
cal.set(Calendar.DAY_OF_MONTH, i);
System.out.println(sf.format(cal.getTime()));
}

没有评论:

发表评论