MySQL TO_DAYS Function

Example

Return the number of days between the date and year 0:

SELECT TO_DAYS("2017-06-20");

Definition and Usage

The TO_DAYS() function returns the number of days between a date and year 0 (date “0000-00-00”).

The TO_DAYS() function can be used only with dates within the Gregorian calendar.

 

Syntax

TO_DAYS(date)

Continue reading MySQL TO_DAYS Function

MySQL FROM_DAYS Function

Example

Return a date from a numeric representation of the day:

SELECT FROM_DAYS(685467);

Definition and Usage

The FROM_DAYS() function returns a date from a numeric datevalue.

The FROM_DAYS() function is to be used only with dates within the Gregorian calendar.

Continue reading MySQL FROM_DAYS Function