Java Date setHours() MethodThe setHours() method of Java Date class sets hour of the day of this date object to represent new value of date object. It changes the previous hour of the day value to the new specified value. This method is deprecated as of JDK version 1.1 and replaced by Calendar.set(Calendar.HOUR_OF_DAY, int hours). Syntax:ParametersThe parameter 'hours' represents the hour value between 0-23. ReturnNA Example 1Test it NowOutput: Old hour value is : 8 Hour value after setting is : 10 Next TopicJava Util Date |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India