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, 254🔥, 0💬
Popular Posts:
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an exi...
How To Recover a Dropped Index in Oracle? If you have the recycle bin feature turned on, dropped ind...
What Are Out-of-Range Errors with DATETIME values in SQL Server Transact-SQL? When you enter DATETIM...
Where to find MySQL database server tutorials? Here is a collection of tutorials, tips and FAQs for ...