D/MySQL

MySQL SEC_TO_TIME()

yeon.Biju 2020. 4. 3. 09:35

MySQL 날짜함수, 시간함수

 

SEC_TO_TIME()

   - 초를 시간으로 변환

 

SEC_TO_TIME(seconds)

의 형태

 

Returns the seconds argument, converted to hours, minutes, and seconds, as a TIME value. The range of the result is constrained to that of the TIME data type. A warning occurs if the argument corresponds to a value outside that range.

 

 

mysql> SELECT SEC_TO_TIME(2378);
+-------------------+
| SEC_TO_TIME(2378) |
+-------------------+
| 00:39:38          |
+-------------------+
1 row in set (0.00 sec)

mysql> SELECT SEC_TO_TIME(2378)+0;
+---------------------+
| SEC_TO_TIME(2378)+0 |
+---------------------+
|                3938 |
+---------------------+
1 row in set (0.00 sec)