How to Calculate Dates: Adding or Subtracting Days in a Calculation
Learn how to calculate dates by adding or subtracting days in a calculation in Smarter Drafter Pro.
In Smarter Drafter, you can create calculations that add or subtract days from a given date. This is helpful for calculating deadlines, expiration dates, or other time-based data. With the built-in Calculation Builder tool, you can easily perform these operations on dates. This guide will show you how to add or subtract days from a date field in your form.
Instructions
1. Navigate to Your Form
- Open the form where you want to add or subtract days from a date.
2. Create a New Field
- Click on Add Field to create a new field that will hold the result of the date calculation.
3. Choose the Field Type
- Select a Date field type for the new field. This is where the calculated date (with added or subtracted days) will appear.
4. Set Field Properties
- Fill in the necessary field properties such as the field name. Set the field to Read-Only if you want the result to be visible but uneditable, or Hidden if you don’t want the user to see the calculated result.
5. Select the Calculation Tab
- Click on the Calculation tab in the field properties to open the Calculation Builder tool.
6. Click Start Here
- Click the Start Here button to open the Calculation Builder tool, which allows you to set up the date calculation.
7. Choose the Calculation Type
- In the Calculation Builder, select Date as the data type. Then, choose AddDays to add days or SubtractDays to subtract days from a date.
8. Enter the Base Date
- For adding or subtracting days from a date, select the field that contains the starting date. If you want to use today's date as the base, choose Today().
- For example, if you want to add 14 days to today's date, the base date would be Today().
- For example, if you want to add 14 days to today's date, the base date would be Today().
9. Enter the Number of Days
- In the Calculation Builder, specify the number of days you want to add or subtract:
- For AddDays, enter the number of days to add. For example, if you want to add 14 days, your expression would look like this:
Today() + 14 - For SubtractDays, enter a negative number of days to subtract. For example, if you want to subtract 14 days, the expression would be:
Today() - 14
- For AddDays, enter the number of days to add. For example, if you want to add 14 days, your expression would look like this:
10. Save the Field
- After entering the calculation, click Add to insert it into the calculation field. Then, click Save to apply the calculation.
11. Test the Date Calculation
- Test the form by previewing it or filling it out. Ensure that the date calculation works as expected, adding or subtracting the correct number of days.
Common Issues & Solutions
- Issue: The calculated date is incorrect
- Solution: Double-check the calculation expression in the builder. Ensure that the correct date field is selected (e.g., Today() for today’s date) and that the correct number of days is entered. If you are subtracting days, ensure that the number is entered with a negative sign (e.g., -14).