Java Date getMonth() Method

The getMonth() method of Java Date class returns the value between 0 to 11 which represents the month of the year. This method is deprecated as of JDK version 1.1 and replaced by Calender.get(Calender.MONTH)

ValueMonth
0January
1February
2March
3April
4May
5June
6July
7August
8September
9October
10November
11December

Syntax:

Parameters

NA

Return

It returns the month of the year represented by this date object.

Example

Test it Now

Output:

Month of the year is  : 8

Next TopicJava Util Date




Latest Courses