MariaDBで秒数から時刻に変換するサンプル

環境
MariaDB 10.6.4

書式
SEC_TO_TIME( 秒数 )
「SEC_TO_TIME()」を使用して、秒数から時刻に変換します。

使用例1

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
MariaDB [(none)]> SELECT SEC_TO_TIME(3600) result;
+----------+
| result |
+----------+
| 01:00:00 |
+----------+
1 row in set (0.000 sec)
MariaDB [(none)]> SELECT SEC_TO_TIME(3600) result; +----------+ | result | +----------+ | 01:00:00 | +----------+ 1 row in set (0.000 sec)
MariaDB [(none)]> SELECT SEC_TO_TIME(3600) result;
+----------+
| result   |
+----------+
| 01:00:00 |
+----------+
1 row in set (0.000 sec)

使用例2

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
MariaDB [(none)]> SELECT SEC_TO_TIME(86400) result;
+----------+
| result |
+----------+
| 24:00:00 |
+----------+
1 row in set (0.000 sec)
MariaDB [(none)]> SELECT SEC_TO_TIME(86400) result; +----------+ | result | +----------+ | 24:00:00 | +----------+ 1 row in set (0.000 sec)
MariaDB [(none)]> SELECT SEC_TO_TIME(86400) result;
+----------+
| result   |
+----------+
| 24:00:00 |
+----------+
1 row in set (0.000 sec)

 

MariaDB

Posted by arkgame