Collections:
DATE() - Extracting Date
How to obtain the date from a datetime using the DATE() function?
✍: FYIcenter.com
DATE(dt) is a MySQL built-in function that
returns the date from a datetime.
For example:
SELECT DATE('2023-12-31 01:02:03');
-- +-----------------------------+
-- | DATE('2023-12-31 01:02:03') |
-- +-----------------------------+
-- | 2023-12-31 |
-- +-----------------------------+
SELECT DATE(NOW());
-- +-------------+
-- | DATE(NOW()) |
-- +-------------+
-- | 2023-11-22 |
-- +-------------+
Reference information of the DATE() function:
DATE(expr): dt Extracts the date part of the date or datetime expression expr. Arguments, return value and availability: expr: Required. The datetime to extract date from. dt: Return value. The extracted date. Available since MySQL 4.
Related MySQL functions:
⇒ DATEDIFF() - Difference of Two Dates
2023-11-17, 1093🔥, 0💬
Popular Posts:
What Is an Oracle Instance in Oracle? Every running Oracle database is associated with an Oracle ins...
What Happens to Your Transactions When ERROR 1213 Occurred in MySQL? If your transaction receives th...
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...
Where to find answers to frequently asked questions on Conditional Statements and Loops in SQL Serve...