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, 1413🔥, 0💬
Popular Posts:
How to download and install the scaled-down database AdventureWorksLT in SQL Server? If you want to ...
What Are the Differences between BINARY and VARBINARY in MySQL? Both BINARY and VARBINARY are both b...
How To Download Oracle Database 10g XE in Oracle? If you want to download a copy of Oracle Database ...
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...