Java Calendar getWeekYear() Method

The getWeekYear() method of java.util.Calendar class is a public method. This method gets the week year of calendar object and returns in integer the week year of calendar.

Syntax

Parameter

No parameter is passed.

Returns

Returns in integer week year of current calendar object .

Throws

UnsupportedOperationException

Example 1

Output:

Current Time:Fri Aug 10 10:52:54 PDT 2018
 week year :2018
Changed Time:Fri Jun 07 10:52:54 PDT 1996
Weeks in week year :1996

Example 2

Output:

Week : 52
Weekayear  : 1969
Year  : 1969