Database/Mysql, MariaDB
[Mysql] Time to Seconds 과 Seconds to time.
denodo
2021. 8. 24. 15:32
SELECT TIME_TO_SEC('05:15:40');
Sample Output:
mysql> SELECT TIME_TO_SEC('05:15:40');
+-------------------------+
| TIME_TO_SEC('05:15:40') |
+-------------------------+
| 18940 |
+-------------------------+
1 row in set (0.02 sec)
mysql> SELECT SEC_TO_TIME(18940);
+-------------------------+
| SEC_TO_TIME(18940) |
+-------------------------+
| 05:15:40 |
+-------------------------+
1 row in set (0.02 sec)
참고: https://www.w3resource.com/mysql/date-and-time-functions/mysql-time_to_sec-function.php