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 / Clause | Requirement | Data Type | Role & Behavior |
|---|---|---|---|
date1 ({EndDate}) | Required | Date / Lookup Field | Target end date (or TODAY()/NOW() for live aging against today). |
date2 ({StartDate}) | Required | Date Field | Starting timestamp subtracted from date1. |
units ("days") | Required | Unit String | Granularity 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
- Extract Text & IDs with Airtable REGEX_EXTRACT — Extract domains, ticket IDs, or codes from messy text strings directly inside Airtable formula columns using REGEX_EXTRACT.
- Build Dynamic Primary Field IDs in Airtable with CONCATENATE — Build clean, readable Airtable Primary Key record titles by combining client name, plan tier, and region with CONCATENATE.
- Conditional Pricing & Discount Formula in Airtable — Compute net payable totals with conditional tax or volume discounts in Airtable using IF(), AND(), and arithmetic operators.
- Calculate Business Due Dates in Airtable with WORKDAY() — Automatically compute SLA due dates skipping Saturdays, Sundays, and optional holidays in Airtable using the WORKDAY() formula function.