bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL TO_DAYS() Function

Concept visual

MySQL TO_DAYS() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

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

Formula

(date "0000 - 00 - 00").

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

Note:

This function is the opposite of the

FROM_DAYS() function.

Syntax

TO_DAYS( date )

Parameter Values

Parameter

Description date

Required. The given date

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return the number of days between the date and year 0: SELECT TO_DAYS("2017-06-20 09:34:00");

Previous

❮ MySQL Functions

Next

Previous

MySQL TIMESTAMP() Function

Next

MySQL WEEK() Function