Adding and Subtracting Dates:
You can add or subtract months, days, hours minutes or seconds from dates. Some scenarios might be:
- When creating an invoice in Xero, we wish to set the due date of the invoice to 30 days after the invoice has been sent
- When creating an opportunity in Salesforce, we wish to set the expected close date of the opportunity to 1 month after the opportunity has been created
- When creating a project in Replicon, we wish to set the expected end date of the project to 1 year after the opportunity has been created
The examples below use the datetime stamp 2019-08-15T12:00:00+0000
Operator | Addition Example | Addition Result | Subtraction Example | Subtraction result |
months | [pill] + 1.months | 2019-09-15T12:00:00+0000 | [pill] - 5.months | 2019-03-15T12:00:00+0000 |
days | [pill] + 2.days | 2019-08-17T12:00:00+0000 | [pill] - 4.days | 2019-08-11T12:00:00+0000 |
hours | [pill] + 3.hours | 2019-08-15T15:00:00+0000 | [pill] - 3.hours | 2019-08-15T09:00:00+0000 |
minutes | [pill] + 4.minutes | 2019-08-15T12:04:00+0000 | [pill] - 2.minutes | 2019-08-15T11:58:00+0000 |
seconds | [pill] + 5.seconds | 2019-08-15T12:00:05+0000 | [pill] - 1.seconds | 2019-08-15T11:59:59+0000 |
Note: Even if you are only adding or subtracting 1 unit of time (e.g. 1 hour, 1 day), you will need to indicate the unit in plural form, i.e. hours, days in formula mode.