I am getting issue while fetching WEEK_OF_YEAR
from calendar object.
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
Every time it returns different value . Could you please help me to solve this issue.
code is as below.
Calendar calendar1 = Calendar.getInstance();
calendar1.setTime('31-Dec-2012');
calendar1.set(Calendar.HOUR_OF_DAY, 0);
calendar1.setFirstDayOfWeek(Calendar.MONDAY);