Java Calendar MONTH

Syntax

Calendar.MONTH has the following syntax.

public static final int MONTH

Example

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


import java.util.Calendar;
/*from w  ww  .j  av a 2  s. c  om*/
public class Main {
  public static void main(String[] args) {

    Calendar now = Calendar.getInstance();

    System.out.println((now.get(Calendar.MONTH) + 1));

  }
}

The code above generates the following result.