DATEDIFF() in MySQL — How It Works

What the MySQL DATEDIFF() function does, with an example.

Published October 19, 2026

DATEDIFF() returns the number of days between two dates.

Key points

  • Part of standard SQL functions available in MySQL for working with dates and times

Example

SELECT DATEDIFF('2024-12-31', '2024-01-01');
More SQL articles