我得到的问题,同时获取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);