Home »
MySQL »
MySQL date/time Functions
MySQL TO_DAYS() Function
MySQL | TO_DAYS() Function: Learn about the TO_DAYS() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 12, 2022
TO_DAYS() Function
The TO_DAYS() function will convert the date into the numeric number of days. This function counts the total number of days between the date and the year.
TO_DAYS() Syntax
SELECT TO_DAYS(date value);
TO_DAYS() Parameter(s)
As a parameter, you only have to provide the date on which you want to count the number of days.
TO_DAYS() Return Value
As a result, it will display the total number of days according to the date you have provided.
MySQL TO_DAYS() Function Example 1
SELECT TO_DAYS('2022-09-12');
MySQL TO_DAYS() Function Example 2
SELECT TO_DAYS('2011-12-09');