Mysql To_days Function
MySQL: TO_DAYS Function
This tutorial explains how to use the MySQL TO_DAYS function with syntax and examples.
Description
The MySQL TO_DAYS function converts a date into numeric days.
Syntax
The syntax for the TO_DAYS function in MySQL is:
Parameters or Arguments
- date
The date to convert to numeric days.
Note
- The TO_DAYS function is to be used only with dates within the Gregorian calendar.
- The TO_DAYS function will return NULL, if date is '0000-00-00'.
- See also the FROM_DAYS function which is the reverse of the TO_DAYS function.
Applies To
The TO_DAYS function can be used in the following versions of MySQL:
- MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23
Example
Let's look at some MySQL TO_DAYS function examples and explore how to use the TO_DAYS function in MySQL.
For example: