The following sql is to calculate the week number of 20811231, the result is 1, which means 20181231's year week is 201901
select to_number(to_char(to_date('20181231','YYYYMMDD'), 'iw')) from dual
What I am doing now is to write a java method that does the same thing as the above sql: input 20181231, the method will output 1,and for other inputs, the output should also be the same.
I want to ask how I can achieve this using java.util.Calendar class