Java Date getDay() Method

The getDay() method of java date class returns the value between 0 to 6 which represents the day of the week by this date object.

ValueDay
0Sunday
1Monday
2Tuesday
3Wednesday
4Thursday
5Friday
6Saturday

This method is deprecated as of JDK version 1.1 and replaced by Calender.get(Calender.DAY_OF_WEEK)

Syntax:

Parameters

NA

Return

It returns the day of the week represented by this date object.

Example 1

Test it Now

Output:

day of the week is  : 3

Next TopicJava Util Date




Latest Courses