Java Date Time - Month MARCH example








Month MARCH defines the singleton instance for the month of March with 31 days.

This has the numeric value of 3.

Syntax

MARCH has the following syntax.

public static final Month MARCH

Example

The following example shows how to use MARCH.

import java.time.Month;
/* w  w w. j a  v a2  s .  c  o  m*/
public class Main {
  public static void main(String[] args) {
    Month m = Month.MARCH;
    System.out.println(m.getValue());
    System.out.println(m.name());
    System.out.println(m.ordinal());
  }
}

The code above generates the following result.