WEEK_OF_YEAR
从日历对象获取时出现问题。
by passing date '31-Dec-2014':
calendar1.get(Calendar.WEEK_OF_YEAR) - return 1
by passing date '31-Dec-2015'
calendar1.get(Calendar.WEEK_OF_YEAR) - return 53
by passing date '31-Dec-2016'
calendar1.get(Calendar.WEEK_OF_YEAR) - return 52
by passing date '31-Dec-2017'
calendar1.get(Calendar.WEEK_OF_YEAR) - return 52
by passing date '31-Dec-2018'
calendar1.get(Calendar.WEEK_OF_YEAR) - return 1
每次它返回不同的值。你能帮我解决这个问题吗?
代码如下。
Calendar calendar1 = Calendar.getInstance();
calendar1.setTime('31-Dec-2012');
calendar1.set(Calendar.HOUR_OF_DAY, 0);
calendar1.setFirstDayOfWeek(Calendar.MONDAY);