LocalDateTime getMonthValue() method in Java with Examples
The getMonthValue() method of LocalDateTime class is used to return the month-of-year field. This method returns the month from LocalDateTime as an int from 1 to 12.
public int getMonthValue()
Parameter: This method does not accept any parameter.
Returns: This method returns integer value which is the month-of-year field and it ranges from 1 to 12.
Below programs illustrate the LocalDateTime.getMonthValue() method:
Month Value: 10
Month Value: 12