我试图得到一年中的总周数,我使用这个指令:
Calendar now = Calendar.getInstance();
now.set(Calendar.YEAR,annoInizio);
now.set(Calendar.MONTH,11);
now.set(Calendar.DATE, 30);
int settTotInizio = now.get(Calendar.WEEK_OF_YEAR);
我现在打印变量和 settTotinizio,现在 WEEK_OF_YEAR 的值是 40,但在 settTotInizio 中是 1。
我不明白我哪里做错了。有人能帮我吗?
这是我的日志:
I/System.out(30038): ,firstDayOfWeek=2,minimalDaysInFirstWeek=0,ERA=1,YEAR=2013,MONTH=11,WEEK_OF_YEAR=40,WEEK_OF_MONTH=1,DAY_OF_MONTH=30,DAY_OF_YEAR=275,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=1,AM_PM=1,HOUR=0,HOUR_OF_DAY=12,MINUTE=48,SECOND=49,MILLISECOND=762,ZONE_OFFSET=3600000,DST_OFFSET=3600000]
I/System.out(30038): settTotInizio: 1