MySQL TO_DAYS()
MySQL 날짜함수, 시간함수
TO_DAYS()
-
TO_DAYS(date)
의 형태
Given a date date, returns a day number(the number of days since year 0)
TO_DAYS() is not intended for use with values that precede the advent of the Gregorian calendar(1582), because it does not take into account the days that were lost when the calendar was changed. For dates before 1582(and possibly a later year in other locales), results from this function are not reliable.
Remember that MySQL converts two-digit year values in dates to four-digit form using the rules ...
mysql> SELECT TO_DAYS(950501);
+-----------------+
| TO_DAYS(950501) |
+-----------------+
| 728779 |
+-----------------+
1 row in set (0.00 sec)
mysql> SELECT TO_DAYS(NOW());
+----------------+
| TO_DAYS(NOW()) |
+----------------+
| 737885 |
+----------------+
1 row in set (0.00 sec)
mysql> SELECT TO_DAYS('2020-04-01');
+-----------------------+
| TO_DAYS('2020-04-01') |
+-----------------------+
| 737881 |
+-----------------------+
1 row in set (0.00 sec)