Description | The |
Syntax | DATE_DIFF( |
Output | integer |
Variables
End_date
: The ending date for the calculation.Start_date
: The starting date for the calculation."day"/"week"/"month"/"quarter"/"year": Specify the time unit (day, week, month, quarter, or year) for the calculation.
NOTE: Please note that the End_date
and Start_date
should both be in the same data type (e.g., date or datetime).
Example 1
DATE_DIFF(`End Date`, `Start Date`, "DAY")
Project | Start Date | End Date | DATE_DIFF |
Project A | 2023-09-05 | 2023-09-15 | 10 |
Project B | 2023-08-25 | 2023-09-10 | 16 |
Project C | 2023-09-01 | 2023-09-30 | 29 |
Example 2
DATE_DIFF(`End Date`, `Start Date`,"WEEK")
Project | Start Date | End Date | DATE_DIFF |
Project A | 2023-09-05 | 2023-09-15 | 1 |
Project B | 2023-08-25 | 2023-09-10 | 2 |
Project C | 2023-09-01 | 2023-09-30 | 4 |
Example 3
DATE_DIFF(`End Date`, `Start Date`,"MONTH")
Project | Start Date | End Date | DATE_DIFF |
Project A | 2023-09-05 | 2023-09-15 | 0 |
Project B | 2023-08-25 | 2023-09-10 | 1 |
Project C | 2023-09-01 | 2023-09-30 | 0 |