Return the number of days since year 0 for a given date or datetime value.
SELECT TO_DAYS(“2017-06-20”); |
The TO_DAYS() function calculates the number of days between a date and year 0 (date “0000-00-00”) within the Gregorian calendar.
Note: This function performs the inverse operation of the FROM_DAYS() function.
TO_DAYS(date) |
Parameter |
Description |
date |
Required: The specified date |
Works in: |
From MySQL version 4.0 |
Calculate the number of days from year 0 to the given date.
SELECT TO_DAYS(“2017-06-20 09:34:00”); |