Java GregorianCalendar .getWeeksInWeekYear ()

Syntax

GregorianCalendar.getWeeksInWeekYear() has the following syntax.

public int getWeeksInWeekYear()

Example

In the following code shows how to use GregorianCalendar.getWeeksInWeekYear() method.


import java.util.GregorianCalendar;
//from   ww w . j av a 2s .  com
public class Main {

   public static void main(String[] args) {

      GregorianCalendar cal = 
              (GregorianCalendar) GregorianCalendar.getInstance();

      System.out.println(cal.getTime());
      
      System.out.println(cal.getWeeksInWeekYear());

   }
}

The code above generates the following result.