Name
TO_DAYS( )
Synopsis
TO_DAYS(date
)
This
function returns the date based on the number of days given, which
are from the beginning of the currently used standard calendar.
Problems occur for dates before 1582 when the Gregorian calendar
became the standard. The opposite of this function is
FROM_DAYS( )
.
SELECT (TO_DAYS('2005-01-15') - TO_DAYS('2005-01-01')) AS 'Difference'; +------------+ | Difference | +------------+ | 14 | +------------+
In this
example, the TO_DAYS( )
function is employed to
calculate the difference in the number of days between the two dates.
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.