Finding the Number of Days Between Two Date Fields

There are a few ways you can get the number of days between two dates.

Using the Date Difference transform

See the help article How to use the Date Difference transform for more detailed instructions on using this transform.

Using the Calculated Columns transform

Use this formula:

{end_date_column}-{start_date_column}

If you are comparing two date fields without timestamps, then it will return a whole number. If one or both have a timestamp, then it will give you the number of days, hours, minutes, and seconds between the dates.

days-between-calculated-columns.png

Using a SQL transform:

SELECT *,
DATE_PART('day', "end_date" - "start_date") ?as? "days_between"
FROM? report

or

SELECT *,
"end_date"::DATE - "start_date"::DATE AS "days_between"
FROM report
Was this article helpful?