Java Date Time - 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;
// w  ww.  jav  a 2 s. c  o m
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.