MySQL Tutorial/Date Time Functions/TIME

Материал из SQL эксперт
Перейти к: навигация, поиск

SELECT TIME("2003-02:03.000123");

mysql>
mysql> SELECT TIME("2003-12-31 01:02:03.000123");
+------------------------------------+
| TIME("2003-12-31 01:02:03.000123") |
+------------------------------------+
| 01:02:03.000123                    |
+------------------------------------+
1 row in set (0.00 sec)
mysql>


TIME(expr) extracts the time part of the time or datetime expression expr and returns it as a string.

mysql>
mysql> SELECT TIME("2003-12-31 01:02:03");
+-----------------------------+
| TIME("2003-12-31 01:02:03") |
+-----------------------------+
| 01:02:03                    |
+-----------------------------+
1 row in set (0.00 sec)