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, 1194🔥, 0💬
Popular Posts:
How To Use GO Command in "sqlcmd" in SQL Server? "sqlcmd" is a command line client application to ru...
Where to find MySQL database server tutorials? Here is a collection of tutorials, tips and FAQs for ...
Where to find answers to frequently asked questions on Transaction Management: Commit or Rollback in...
Can You Drop an Index Associated with a Unique or Primary Key Constraint in Oracle? You can not dele...
How To Install Oracle Database 10g XE in Oracle? To install 10g universal edition, double click, Ora...