웹이야기

MySQL TO_SECONDS() 본문

D/MySQL

MySQL TO_SECONDS()

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

MySQL 날짜함수, 시간함수

 

TO_SECONDS()

   -

 

TO_SECONDS(expr)

의 형태

 

Given a date or datetime expr, returns the number of seconds since the year 0. If expr is not a valid date or datetime value, returns NULL.

 

mysql> SELECT TO_SECONDS(NOW());
+-------------------+
| TO_SECONDS(NOW()) |
+-------------------+
|       63753308673 |
+-------------------+
1 row in set (0.00 sec)

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

mysql> SELECT TO_SECONDS('2020:04:01 12:34:34');
+-----------------------------------+
| TO_SECONDS('2020:04:01 12:34:34') |
+-----------------------------------+
|                       63752963674 |
+-----------------------------------+
1 row in set (0.00 sec)

 

 

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

MySQL UTC_DATE()  (0) 2020.04.05
MySQL UNIX_TIMESTAMP()  (0) 2020.04.05
MySQL TO_DAYS()  (0) 2020.04.05
MySQL TIME_TO_SEC()  (0) 2020.04.05
MySQL TIME_FORMAT()  (0) 2020.04.04
Comments