The function AddDate() takes three parameters:
2. offset: An integer (positive or negative) that determines the number of date units that will be added to (or subtracted from) the oldDate object.
3. offsetType: The measurement unit of the offset parameter. “Y” or “y” means Year, “M” or “m” means Month, “D” or “d” means Day, “H” or “h” means Hour. Likewise, you can modify the above function to allow Minute, Second, and Millisecond.
1. To get the date that is 21 days from the current date:
2. To get the date that is 2 years before the current date:
Hope this helps.