웹이야기

MySQL TO_DAYS() 본문

D/MySQL

MySQL TO_DAYS()

yeon.Biju 2020. 4. 5. 12:18

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)


'D > MySQL' 카테고리의 다른 글

MySQL UNIX_TIMESTAMP()  (0) 2020.04.05
MySQL TO_SECONDS()  (0) 2020.04.05
MySQL TIME_TO_SEC()  (0) 2020.04.05
MySQL TIME_FORMAT()  (0) 2020.04.04
MySQL TIMESTAMPDIFF()  (0) 2020.04.04
Comments