Java Date getHours() Method

The getHours() method of Java Date class returns the value between 0 to 23 which represents the hour within the day by this date object. This method is deprecated as of JDK version 1.1 and replaced by Calender.get(Calender.HOUR_OF_DAY)

Syntax:

Parameters

NA

Return

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

Example 1

Test it Now

Output:

Hour of the day is  : 10

Next TopicJava Util Date




Latest Courses