Java Calendar get() MethodThe get() method of Calender class returns the value of the parameter fields passed into it. Fields like DAY_OF_MONTH, MONTH, YEAR, WEEK, WEEK_OF_YEAR etc are passed as parameter to this method. SyntaxParameterAny field of calendar is passed as parameter. ReturnsReturn value of passed field as parameter in integer form. ThrowsArrayIndexOutOfBoundsException Example 1Output: Day of month is: 2 Month of year is: 7 and year is : 2018 Today is 2 Day of 7 Month of the year 2018 Example 2Output: Hour is : 8 Minute is: 1 Second is1 Time : 8:1:1 Example 3Output: Date when objectt is created : Thu Aug 02 08:07:16 PDT 2018 date after using add method : Wed Jun 25 08:07:16 PDT 4036 HOUR : 8 MINUTE : 7 SECOND : 16 |
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