Java Calendar add() MethodThis method adds the specified (signed) amount of time to the given calendar field, based on the calendar's rules. SyntaxParameterfield - the calendar field. amount - the amount of date or time to be added to the field. ReturnsThis method does not return a value ThrowsIllegalArgumentException - if field is ZONE_OFFSET, DST_OFFSET, or unknown, or if any calendar fields have out-of-range values in non-lenient mode. Example 1Output: Sun Jul 29 07:42:05 PDT 2018 Thu Jul 29 07:42:05 PDT 2027 Example 2Output: Sun Jul 29 07:43:38 PDT 2018 Sat Sep 29 07:43:38 PDT 2018 Example 3Output: Sun Jul 29 07:44:56 PDT 2018 Wed Aug 08 07:44:56 PDT 2018 Example 4Output: Sun Jul 29 07:46:00 PDT 2018 Sun Jul 29 17:46:00 PDT 2018 Sun Jul 29 17:56:00 PDT 2018 Sun Jul 29 17:56:10 PDT 2018 Next TopicJava-calendar-after-method |
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