Java Calendar WEEK_OF_YEAR

Syntax

Calendar.WEEK_OF_YEAR has the following syntax.

public static final int WEEK_OF_YEAR

Example

In the following code shows how to use Calendar.WEEK_OF_YEAR field.


import java.util.Calendar;
//from w  w w .  j  a  v  a2 s  .  c o m
public class Main {
  public static void main(String[] args) {
    Calendar now = Calendar.getInstance();
    System.out.println(now.getTime());

    System.out.println(now.get(Calendar.WEEK_OF_YEAR));

  }
}

The code above generates the following result.