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, 1203🔥, 0💬
Popular Posts:
How To Start the Command-Line SQL*Plus in Oracle? If you Oracle server or client installed on your w...
Can Date and Time Values Be Converted into Integers in SQL Server Transact-SQL? Can date and time va...
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...
How To Provide Default Values to Function Parameters in SQL Server Transact-SQL? If you add a parame...