Airtables

Airtable DATETIME_DIFF: days, decimal hours and Duration

Choose whole days, decimal hours or an h:mm duration, with blank-safe formulas and clear expected results.

A metal divider spans the interval between two brass clips on a blank paper ribbon.

Use DATETIME_DIFF({End}, {Start}, "days") for whole elapsed days between two Airtable dates. For decimal hours, calculate seconds and divide by 3600; for a Duration display such as 1:30, keep the result in seconds. I'd choose the counting rule before formatting the field, because elapsed hours, calendar dates and billing periods can give different correct answers for the same two timestamps.

Build a blank-safe date-difference field

This calculation is available on every Airtable plan. Creating or changing a Formula field requires Owner or Creator permissions, as shown in Airtable's date-difference guide. Work in a new field first so existing reports and automations keep their current inputs while you check the result.

  1. Open the table holding both dates. Add or identify Date fields named Start and End.
  2. Enable the time in both fields if the interval depends on hours or minutes. Include the actual end date for an overnight interval.
  3. Click + to add a field, choose Formula and name it Elapsed days.
  4. Paste the expression below, replacing the field names with yours.
  5. Choose a numeric output format, then click Create field or Save.
IF(
  AND({Start}, {End}),
  DATETIME_DIFF({End}, {Start}, "days"),
  BLANK()
)

With Start on April 10 at 9:00 AM and End on April 12 at 9:00 AM in the same zone, the expected result is 2. With either date empty, the guarded expression leaves the result blank. An incomplete record therefore won't look like a completed zero-day task.

DATETIME_DIFF(date1, date2, "units") subtracts the second date from the first. A negative result flags a reversed interval. Even a zero in a large unit can cover two different timestamps. To check their exact order, use IS_BEFORE({End}, {Start}) inside the same guard for missing dates. Airtable's function reference covers both date comparisons. The Formula field guide explains braces and field references if the expression won't save.

Airtable DATETIME_DIFF uses End first and checks that both dates are present
Recognize the argument order before checking the count. A missing input leaves the result blank. View full size.

Choose whole units, decimal hours or a Duration

DATETIME_DIFF returns whole integers for every supported unit. Showing more decimal places changes the display, not the precision already discarded. To retain a partial hour, use a smaller unit before dividing.

Choose the calculation and the output format together
What you needCore expressionOutput format
Whole daysDATETIME_DIFF({End}, {Start}, "days")Number
Whole minutesDATETIME_DIFF({End}, {Start}, "minutes")Number
Decimal hoursDATETIME_DIFF({End}, {Start}, "seconds") / 3600Number with decimal places
Decimal 24-hour periodsDATETIME_DIFF({End}, {Start}, "seconds") / 86400Number with decimal places
Hours and minutes, such as 1:30DATETIME_DIFF({End}, {Start}, "seconds")Duration, h:mm

Wrap the chosen core expression in the two-date guard above when records can be incomplete. For 9:00 AM to 10:30 AM on one date, the expected results are 90 minutes, 1 whole hour and 0 whole days. None includes a fractional unit.

Return 1.5 decimal hours

IF(
  AND({Start}, {End}),
  DATETIME_DIFF({End}, {Start}, "seconds") / 3600,
  BLANK()
)

Select a numeric format with decimal places. The ninety-minute example gives 5400 / 3600 = 1.5. Airtable also documents minutes divided by 60; that's sufficient when whole-minute precision matches the job. Seconds retain sub-minute intervals. Display rounding and a rule such as charging for every started quarter-hour are separate decisions; label the field with the rule your report uses.

Display 1:30 without turning the result into text

IF(
  AND({Start}, {End}),
  DATETIME_DIFF({End}, {Start}, "seconds"),
  BLANK()
)

Open the Formula field's Formatting tab, choose Duration and select h:mm. Airtable's Duration field instructions confirm that the underlying value is seconds regardless of its display. Here 5400 displays as 1:30. A result of 90 would represent ninety seconds, not ninety minutes.

Keep the formula numeric if another field will total or compare it. Appending & " hours" produces a text label and removes Duration formatting. Use the field name or description for the unit instead.

Airtable grid shows 5400 seconds, 1.5 hours, and Duration displayed as 1:30
The seconds and Duration fields can represent the same numeric result. A separate decimal-hours field divides seconds by 3600. View full size.

Use a supported unit, with its exact capitalization

Airtable's unit-specifier list supports the following names and abbreviations. I'd use full names in shared formulas: someone maintaining "minutes" is less likely to mistake it for months.

DATETIME_DIFF units
Full nameAbbreviationFull nameAbbreviation
millisecondsmssecondss
minutesmhoursh
daysdweeksw
monthsMquartersQ
yearsy

Lowercase "m" means minutes; uppercase "M" means months. Put the unit in straight quotation marks and spell it explicitly rather than depending on what a missing or misspelled unit might do.

Separate elapsed time from calendar-day counting

An interval from April 10 at 11:30 PM to April 11 at 12:30 AM lasts one hour. It crosses one calendar-date boundary, and touches two dates if both endpoints count. A whole elapsed-day result of 0 doesn't answer either calendar question.

For elapsed time, keep the original timestamps and choose seconds, minutes or hours. For a calendar-day rule, decide which time zone defines the dates, then reduce both timestamps to dates in that zone. Don't shift an actual timestamp just to make the result resemble a calendar count.

Count local calendar-date boundaries

Create two helper Formula fields named Start calendar date and End calendar date. For timestamps whose reporting calendar is New York, use:

IF(
  {Start},
  DATETIME_PARSE(
    DATETIME_FORMAT(SET_TIMEZONE({Start}, "America/New_York"), "YYYY-MM-DD"),
    "YYYY-MM-DD"
  ),
  BLANK()
)

Use the same expression in End calendar date, replacing {Start} with {End}. Replace the zone in both helpers if your reporting calendar is elsewhere. This combines Airtable's documented SET_TIMEZONE, DATETIME_FORMAT and DATETIME_PARSE pattern: format the local date as text, then parse that date for arithmetic.

These helpers deliberately discard the time. They represent date labels for counting, not corrected versions of the original instants. Set their date display to GMT/UTC so the parsed date isn't displayed as the previous day in another zone. Then calculate:

IF(
  AND({Start calendar date}, {End calendar date}),
  DATETIME_DIFF({End calendar date}, {Start calendar date}, "days"),
  BLANK()
)

The overnight example now gives 1. If your rule counts both the start and end dates and End is on or after Start, add 1 to this normalized day difference: one same-day booking becomes 1, and April 10–11 becomes 2. Reject or flag reversed ranges before applying that inclusive rule. Adding 1 to an arbitrary timestamp difference doesn't establish the right calendar or fix a bad input.

Airtable date-difference example gives zero elapsed days and one local date boundary
These timestamps are 40 minutes apart. Whole elapsed days and local calendar boundaries answer different questions. View full size.

Check daylight-saving boundaries with the right rule

A local calendar day can span 23 or 25 elapsed hours where clocks change. Keep original timestamps for actual elapsed work or an hour-based SLA; use the date helpers for a calendar-day count. Airtable's time-zone guidance distinguishes DST-aware America/New_York from a fixed-offset zone. A hard-coded four- or five-hour adjustment isn't a year-round substitute for the named zone.

Count complete months or compare reporting months

DATETIME_DIFF({End}, {Start}, "months") asks for a whole-unit interval between dates. It doesn't ask how many month headings a report crosses. Don't replace it with days / 30 or years with days / 365; those are fixed-length approximations with different rules.

If January 31 to February 1 should count as one reporting-month step, compare the year and month of the normalized date helpers:

IF(
  AND({Start calendar date}, {End calendar date}),
  12 * (YEAR({End calendar date}) - YEAR({Start calendar date}))
    + MONTH({End calendar date}) - MONTH({Start calendar date}),
  BLANK()
)

This returns 1 for January to February and 1 for December to the following January; two dates in the same reporting month return 0. It is a bucket difference, not elapsed tenure or a count of billable months. A label such as “1 year, 3 months, 15 days” needs a separate rule for remainder months, month-end dates and inclusive endpoints; don't obtain it by dividing a single day count into 365s and 30s.

Calculate days remaining, elapsed age or overdue status

For days remaining until a date-based deadline, keep the deadline first:

IF({Due date}, DATETIME_DIFF({Due date}, TODAY(), "days"), BLANK())

For whole days since a stored date, reverse the direction:

IF({Start}, DATETIME_DIFF(TODAY(), {Start}, "days"), BLANK())

Use NOW() when the current time of day matters. For “has this exact deadline passed?”, compare the timestamps directly instead of testing whether a whole-day count is negative:

IF(
  {Due date},
  IF(IS_BEFORE({Due date}, NOW()), "Overdue", "Not overdue"),
  BLANK()
)

A deadline can be overdue by an hour while its whole-day difference is still 0. If “today” must mean the team's local calendar date, derive it from NOW() with the same local-date normalization used above, then compare date labels.

Airtable refreshes TODAY and NOW when the base loads or the formula recalculates, and periodically while the base is open. In a closed base, the function reference describes an approximately hourly refresh when time-dependent automation or sync depends on it. Configure a separate reminder automation to send a message when a deadline is near.

Fix errors by checking the input type first

Diagnose the result before changing the counting rule
SymptomLikely checkWhat to do
0 for a short intervalThe requested unit is larger than the intervalUse seconds or minutes, then divide if a decimal result is required.
A negative numberEnd comes before StartCheck the argument order and the stored dates, including the date of an overnight shift.
NaN, an error, or swapped month/dayText instead of a structured dateParse the actual input format explicitly; changing the field's display alone won't parse text.
Wrong value from a related tableA lookup contains a list, or a formula converted a date to textSelect the intended related date and keep a structured date for calculation.
Duration looks far too smallMinutes or decimal hours were formatted as secondsReturn seconds before choosing Duration.
The date looks a day outTime-zone display or an incorrectly entered timestampShow both inputs with their times and compare each field's zone configuration.

For a text field containing 2026-04-10, DATETIME_PARSE({Start text}, "YYYY-MM-DD") creates the date input. Match the format to the real data, not to how you want the result to look. DATETIME_FORMAT goes in the opposite direction: it produces text. Keep the date for arithmetic and put a readable label in a separate field; see the date-formatting guide.

Airtable's lookup documentation explains that lookup values arrive as an array. Choose what one related date means before calculating. If it means the latest linked completion, create a Rollup field named Latest end, select the linked records and their completion Date field, and use MAX(values). A rollup is the documented way to produce one latest-date answer from linked records.

Also create Related end count, rolling up the same Date field with COUNTA(values). The rollup reference distinguishes counting non-empty values from counting every linked record, and warns that empty rollups are treated as true by AND. Use the count to guard the calculation:

IF(
  AND({Start}, {Related end count} > 0),
  DATETIME_DIFF({Latest end}, {Start}, "days"),
  BLANK()
)

Select the earliest date instead if that's the rule the workflow needs. Don't join several dates into a string and parse the combined text. The lookup diagnostic covers missing links and unexpected values.

If the inputs are Duration fields, they contain lengths in seconds rather than dates. For Actual duration and Planned duration, use {Actual duration} - {Planned duration} for seconds, or divide that subtraction by 60 for minutes. A zero duration is a valid value, so don't apply a date-style truthiness guard that treats zero as missing.

For zone problems, open each Date field's configuration and compare Use the same time zone for all collaborators and the selected zone. Displaying the same instant in two zones doesn't create elapsed time between them. Correct any upstream import assumption if the stored timestamp itself is wrong.

Check the field with ordinary, empty and boundary records

Use the following expected cases with your own field names before a report, reminder or billing workflow reads the result. Each clock-time pair uses the same zone unless a different rule is named.

Expected results for the selected rule
InputsExpected result
9:00 AM → 10:30 AM, same date90 minutes; 1 whole hour; 1.5 decimal hours; 5400 seconds; 1:30 as Duration
Identical Start and End0; an inclusive same-date booking counts 1 only under that separate rule
End one hour before Start-60 minutes; inspect or flag the reversed range
Either Date input emptyBlank with the guarded recipes
11:30 PM → 12:30 AM next date1 elapsed hour; 0 whole elapsed days; 1 normalized calendar-day boundary
December 31 → January 1, reporting-month rule1 month bucket, including the year change

For working-day counts, use WORKDAY_DIFF; ordinary DATETIME_DIFF doesn't exclude weekends. To return a new deadline rather than an interval, use DATEADD. For a date-difference field, stop when the normal, empty and boundary records match the rule named in that field.