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
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.