MySQL Tutorial/Date Time Functions/TO DAYS

Материал из SQL эксперт
Перейти к: навигация, поиск

Deal with two-digit-year value

mysql>
mysql> SELECT TO_DAYS("1997-10-07"), TO_DAYS("97-10-07");
+-----------------------+---------------------+
| TO_DAYS("1997-10-07") | TO_DAYS("97-10-07") |
+-----------------------+---------------------+
|                729669 |              729669 |
+-----------------------+---------------------+
1 row in set (0.00 sec)
mysql>


SELECT TO_DAYS("1997-10-07");

mysql>
mysql> SELECT TO_DAYS("1997-10-07");
+-----------------------+
| TO_DAYS("1997-10-07") |
+-----------------------+
|                729669 |
+-----------------------+
1 row in set (0.00 sec)
mysql>


TO_DAYS(date) returns a day number (the number of days since year 0).

mysql>
mysql> SELECT TO_DAYS(950501);
+-----------------+
| TO_DAYS(950501) |
+-----------------+
|          728779 |
+-----------------+
1 row in set (0.00 sec)
mysql>