Java Date Time - 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  w  w  w . j av  a2 s  .  c o  m*/
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.