Calendar add() Method in Java with Examples
The add() method of Calendar class present inside is used to add or subtract from the given calendar field(int field), a specific amount of time(int amt), based on the calendar’s rules.
public abstract void add(int field, int amt)
Parameters: The method takes two parameters:
- The field of the calendar on which the operation is to be performed. (Integer type)
- The amount of time needed to be subtracted. (Integer type)
Return Value: The method does not return any value.
Current Date: Tue Feb 12 10:54:21 UTC 2019 After 50 days: Wed Apr 03 10:54:21 UTC 2019 6 months ago it was: Wed Oct 03 10:54:21 UTC 2018 2 years ago it was: Mon Oct 03 10:54:21 UTC 2016
Current Date: Tue Feb 12 10:54:24 UTC 2019 After 30 days: Thu Mar 14 10:54:24 UTC 2019 3 months ago it was: Fri Dec 14 10:54:24 UTC 2018 10 years ago it was: Sun Dec 14 10:54:24 UTC 2008
My Personal Notes arrow_drop_up
Please Login to comment...