Java Date Time - Month FEBRUARY example








Month FEBRUARY defines the singleton instance for the month of February with 28 days, or 29 in a leap year.

This has the numeric value of 2.

Syntax

FEBRUARY has the following syntax.

public static final Month FEBRUARY

Example

The following example shows how to use FEBRUARY.

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

The code above generates the following result.