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, 1107🔥, 0💬
Popular Posts:
What Are Bitwise Operations in SQL Server Transact-SQL? Bitwise operations are binary operations per...
How To Start MySQL Server in MySQL? If you want to start the MySQL server, you can run the "mysqld" ...
How To Fix the INSERT Command Denied Error in MySQL? The reason for getting the "1142: INSERT comman...
What are DDL (Data Definition Language) statements for tables in SQL Server? DDL (Data Definition La...
How To Convert Numeric Values to Integers in SQL Server Transact-SQL? Sometimes you need to round a ...