Month maxLength() example

Description

Month maxLength() gets the maximum length of this month in days.

Syntax

maxLength has the following syntax.


public int maxLength()

Example

The following example shows how to use maxLength.


import java.time.LocalDate;
import java.time.Month;
/*from w w  w.j a va 2 s.com*/
public class Main {
  public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());
    
    System.out.println(m.maxLength());

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset