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, 1729🔥, 0💬
Popular Posts:
What Is a Parameter File in Oracle? A parameter file is a file that contains a list of initializatio...
How to format a number of bytes in a human-readable unit using the FORMAT_BYTES() function? FORMAT_B...
How To Create a Dynamic Cursor with the DYNAMIC Option in SQL Server Transact-SQL? If the underlying...
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...
How To Concatenate Two Character Strings Together in SQL Server Transact-SQL? Concatenating two char...