Description
The Calculate Date Difference activity computes the difference between two date columns and stores the result in a new column. Users can choose from various units like years, months, days, hours, etc., and optionally retain the original data in the output.
This is useful for calculating metrics like age, duration since last access, time until graduation, and more.
Use this activity to:
- Measure elapsed time between two date fields.
- Create duration-based features (e.g., age, time since event).
- Retain original data alongside calculated fields if needed.
Use case: You can use this activity to calculate the number of years between a student’s enrollment and graduation dates, or find how long ago a customer last accessed your platform.
- Data – Required. Tabular data containing two date columns for comparison.
Output
Output Type | Format | Description |
---|
Data | JSON | Transformed data with difference field |
Configuration Fields
Field Name | Description |
---|
Start Date | Column containing the starting date. |
End Date | Column containing the ending date. |
Difference Units | The unit of time to calculate the difference in. Options include: years , months , days , hours , etc. |
Output Column | Name of the column where the calculated difference will be stored. |
Include Original | If enabled, includes all original input data along with the new calculated column. |
id | name | enrollmentDate | lastAccess | dob | graduationDate | Enrollment date new |
---|
1 | Alice Johnson | 2023-01-15 | 01/15/2023 | 2002-05-10T00:00:00 | 2026-05-15 | 01/15/2023 |
2 | Bob Smith | 15-02-2023 | 15-Feb-2023 | 2003/04/12 | 2027-05-20 | 02/15/2023 |
3 | Charlie Brown | 2023.03.10 | 10 Mar 2023 | 10-06-2001 | 2025-12-30T23:59:59 | 03/10/2023 |
4 | Daisy Adams | 2023/04/01 | April 1, 2023 | 2000-09-21T12:30:00Z | 2024/06/15 | 04/01/2023 |
5 | Ethan Carter | 05-May-2023 | 2023-05-10 | 1999.12.15 | 2024-11-01 | 05/05/2023 |
Sample Configuration
Field | Value |
---|
Start Date | enrollmentDate |
End Date | graduationDate |
Difference Units | Years |
Output Column | Total years |
Include Original | true |
Sample Output
id | name | enrollmentDate | lastAccess | dob | graduationDate | Enrollment date new | Total years |
---|
1 | Alice Johnson | 2023-01-15 | 01/15/2023 | 2002-05-10T00:00:00 | 2026-05-15 | 01/15/2023 | 3.33 |
2 | Bob Smith | 15-02-2023 | 15-Feb-2023 | 2003/04/12 | 2027-05-20 | 02/15/2023 | 4.26 |
3 | Charlie Brown | 2023.03.10 | 10 Mar 2023 | 10-06-2001 | 2025-12-30T23:59:59 | 03/10/2023 | 2.81 |
4 | Daisy Adams | 2023/04/01 | April 1, 2023 | 2000-09-21T12:30:00Z | 2024/06/15 | 04/01/2023 | 1.21 |
5 | Ethan Carter | 05-May-2023 | 2023-05-10 | 1999.12.15 | 2024-11-01 | 05/05/2023 | 1.50 |