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, 249🔥, 0💬
Popular Posts:
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
How To Drop a Stored Procedure in Oracle? If there is an existing stored procedure and you don't wan...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...
What Is a Dynamic Performance View in Oracle? Oracle contains a set of underlying views that are mai...
How To Connect ASP Pages to Oracle Servers in Oracle? If you are running Windows IIS Web server and ...