Java Date Time - Month minLength() example








Month minLength() gets the minimum length of this month in days.

February has a minimum length of 28 days. April, June, September and November have 30 days. All other months have 31 days.

Syntax

minLength has the following syntax.

public int minLength()

Example

The following example shows how to use minLength.

import java.time.LocalDate;
import java.time.Month;
//from   w ww .j  av  a  2  s  .c om
public class Main {
  public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());
    
    System.out.println(m.minLength());

  }
}

The code above generates the following result.