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, 1436🔥, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Transaction Management: Commit or Rollback in...
Where Is the Export Dump File Located in Oracle? If you are not specifying the dump directory and fi...
How to continue to the next iteration of a WHILE loop in SQL Server Transact-SQL? How to use CONTINU...
How To Verify a User name with SQLCMD Tool in SQL Server? The quickest way to verify a user name in ...
How To Revise and Re-Run the Last SQL Command in Oracle? If executed a long SQL statement, found a m...