DAYS
Returns the number of whole days between two dates. Use DAYS when you need a simple day count without specifying units — it's a shortcut for DATEDIFF with "days" as the unit.
Syntax
DAYS(startDate, endDate)startDate(Date or DateTime): The earlier dateendDate(Date or DateTime): The later date
Returns
Number representing the total days between the two dates.
Examples
Calculate project duration
DAYS(PROJECT_START, PROJECT_END)Returns the total days from start to finish.
Days until event
DAYS(CURRDATE(), EVENT_DATE)Shows how many days remain until the event.
Days since purchase
DAYS(PURCHASE_DATE, CURRDATE())Calculates how many days have passed since purchase.
Rental period length
RENTAL_DAYS = DAYS(START_DATE, END_DATE)
TOTAL_COST = RENTAL_DAYS * DAILY_RATESimpler alternative to DATEDIFF(start, end, "days") when you only need days.
Returns whole days only. Partial days are not counted — 1.9 days becomes 1.
Common Patterns
Days remaining in trial:
TRIAL_END = ADDDAYS(SIGNUP_DATE, 30)
DAYS_LEFT = DAYS(CURRDATE(), TRIAL_END)
IF(DAYS_LEFTWarranty check:
WARRANTY_END = ADDYEARS(PURCHASE_DATE, 1)
IF(DAYS(CURRDATE(), WARRANTY_END) > 0, "Under warranty", "Warranty expired")Delivery estimate:
DELIVERY_DATE = ADDDAYS(ORDER_DATE, 5)
`Estimated delivery in ${DAYS(CURRDATE(), DELIVERY_DATE)} days`Late fee calculation:
DAYS_OVERDUE = DAYS(DUE_DATE, CURRDATE())
IF(DAYS_OVERDUE > 0, DAYS_OVERDUE * DAILY_FEE, 0)DAYS vs DATEDIFF
Both calculate day differences, but DAYS is simpler when you only need days:
DAYS(START_DATE, END_DATE)
// Same as:
DATEDIFF(START_DATE, END_DATE, "days")Use DATEDIFF when you need other units like years, months, or hours.
Common Mistakes
Wrong parameter order: It's (start, end). Reversing gives negative values.
Expecting partial days: DAYS returns whole days. 1 day and 23 hours = 1, not 1.96.
Mixing date types: Both dates should be DATE or DATETIME. Mixing can cause unexpected results.
See Also
DATEDIFF · ADDDAYS · CURRDATE · DATE