Java Date Time - Month JULY example








Month JULY defines the singleton instance for the month of July with 31 days.

This has the numeric value of 7.

Syntax

JULY has the following syntax.

public static final Month JULY

Example

The following example shows how to use JULY.

import java.time.Month;
//from   w  ww .  ja  v a  2s. c o m
public class Main {
  public static void main(String[] args) {
    Month m = Month.JULY;
    System.out.println(m.getValue());
    System.out.println(m.name());
    System.out.println(m.ordinal());
  }
}

The code above generates the following result.