Close

Java Date Time - YearMonth.lengthOfMonth() Examples

Java Date Time Java Java API 


Class:

java.time.YearMonth

java.lang.Objectjava.lang.Objectjava.time.YearMonthjava.time.YearMonthjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Method:

public int lengthOfMonth()

Returns the length of the month.


Examples


package com.logicbig.example.yearmonth;

import java.time.YearMonth;

public class LengthOfMonthExample {

public static void main(String... args) {
YearMonth y = YearMonth.of(2010, 2);
System.out.println(y);

int l = y.lengthOfMonth();
System.out.println(l);
}
}

Output

2010-02
28




See Also