Name
DATEDIFF( )
Synopsis
DATEDIFF(date
,date
)
This function returns the number of days in the difference between the two dates given. Although a parameter may be given in date and time format, only the date is used for determining the difference. This function is available as of Version 4.1.1 of MySQL.
SELECT CURDATE( ) AS Today, DATEDIFF('2005-12-25', NOW( )) AS 'Days to Christmas'; +------------+-------------------+ | Today | Days to Christmas | +------------+-------------------+ | 2005-01-11 | 348 | +------------+-------------------+
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.