Collections:
TIME() - Extracting Time
How to obtain the time from a datetime using the TIME() function?
✍: FYIcenter.com
TIME(dt) is a MySQL built-in function that
returns the time from a datetime.
For example:
SELECT TIME('2023-12-31 01:02:03');
-- +-----------------------------+
-- | TIME('2023-12-31 01:02:03') |
-- +-----------------------------+
-- | 01:02:03 |
-- +-----------------------------+
SELECT TIME(NOW()), TIME(NOW(6));
-- +-------------+-----------------+
-- | TIME(NOW()) | TIME(NOW(6)) |
-- +-------------+-----------------+
-- | 15:00:48 | 15:00:48.187593 |
-- +-------------+-----------------+
Reference information of the TIME() function:
TIME(expr): tm Extracts the time part of the time or datetime expression expr and returns it as a string. Arguments, return value and availability: expr: Required. The datetime to extract time from. tm: Return value. The extracted time. Available since MySQL 4.
Related MySQL functions:
⇒ TIMEDIFF() - Difference of Two Timestamps
⇐ SYSDATE() - Current Timestamp
2023-11-17, 1426🔥, 0💬
Popular Posts:
How To Install PHP on Windows in MySQL? The best way to download and install PHP on Windows systems ...
How To End a Stored Procedure Properly in SQL Server Transact-SQL? Where the end of the "CREATE PROC...
How to print value on console in SQL Server Transact-SQL? How to use the PRINT statements? In Transa...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...
What Is Transport Network Substrate (TNS) in Oracle? TNS, Transport Network Substrate, is a foundati...