Airtable Guide · Prompt: “Calculate the number of days between {StartDate} and {EndDate} in Airtable using DATETIME_DIFF”

Calculate Days Between Two Dates in Airtable (DATETIME_DIFF)

Verified by LiveFormulaLab Engineering Team • Updated November 2026

Calculate elapsed days, hours, or weeks between two Date fields in Airtable using DATETIME_DIFF without negative-sign confusion.

Verified Airtable Syntax

DATETIME_DIFF({EndDate}, {StartDate}, "days")

How This Formula Works (Step-by-Step)

In Airtable, subtracting dates directly produces errors. DATETIME_DIFF computes exact calendar intervals in days, hours, weeks, or months.

Step 1: Place the later date ({EndDate}) first and the earlier date ({StartDate}) second to get a positive number.

Step 2: Specify "days" as the unit string so Airtable outputs a clean integer number of days.

Formula Syntax & Arguments Breakdown

Computes the signed calendar duration between two Airtable Date fields in days, hours, weeks, or months via DATETIME_DIFF while guarding missing dates cleanly using IF and BLANK().

Argument / ClauseRequirementData TypeRole & Behavior
date1 ({EndDate})RequiredDate / Lookup FieldTarget end date (or TODAY()/NOW() for live aging against today).
date2 ({StartDate})RequiredDate FieldStarting timestamp subtracted from date1.
units ("days")RequiredUnit StringGranularity such as "days", "hours", "minutes", "weeks", "months", or "years".

3 Real-World Use Cases

  • Tracking project sprint cycle time from kickoff date to launch date.
  • Calculating customer onboarding duration across SaaS implementation records.
  • Measuring invoice days overdue by comparing TODAY() against {DueDate}.

Cross-Platform Equivalents

Excel
=C2-B2
SQL
SELECT end_date - start_date AS elapsed_days FROM projects;
Python Pandas
(pd.to_datetime(df['EndDate']) - pd.to_datetime(df['StartDate'])).dt.days
Airtable
DATETIME_DIFF({EndDate}, {StartDate}, "days")

Common Mistakes & Pro Tips

Pitfalls & How to Fix Them

  • Mistake: Leaving {EndDate} or {StartDate} blank displays ugly #ERROR! badges down the entire Airtable column.

    Fix: Always guard empty dates: IF(AND({StartDate}, {EndDate}), DATETIME_DIFF({EndDate}, {StartDate}, "days"), BLANK()).

  • Mistake: Swapping {StartDate} and {EndDate} order flips the sign unexpectedly from positive to negative.

    Fix: Remember Airtable computes date1 minus date2, so pass the later date first for positive durations.

  • Mistake: Using "days" between two DateTime fields with time enabled truncates partial days (23 hours becomes 0 days).

    Fix: Compare with "hours" and divide by 24, or strip time using SET_TIMEZONE / DATESTR when fractional precision matters.

Engineering Pro Tips

  • Calculate live ticket age against today using DATETIME_DIFF(TODAY(), {CreatedDate}, "days").
  • For business days excluding weekends and holidays, use DATETIME_DIFF only for calendar days and WORKDAY_DIFF({StartDate}, {EndDate}) for workdays.
  • Configure the formula Formatting tab to Integer so counts display cleanly without decimals.
  • Combine with ABS(DATETIME_DIFF(...)) when calculating absolute variance between planned launch dates and actual ship dates.

Frequently Asked Questions

Why is my DATETIME_DIFF returning a negative number?
DATETIME_DIFF calculates (date1 - date2). Swap the first two arguments if you want a positive duration.
How do I prevent #ERROR! when {EndDate} is still blank?
Wrap the formula in a guard: IF(AND({StartDate}, {EndDate}), DATETIME_DIFF({EndDate}, {StartDate}, "days"), BLANK()).
Does DATETIME_DIFF count weekends?
Yes. For business days excluding Saturday and Sunday, use WORKDAY_DIFF({StartDate}, {EndDate}) instead.

Related Formulas & Guides