Collections:
LAST_DAY() - Last Day of Month
How to convert a date to the month-end date using the LAST_DAY() function?
✍: FYIcenter.com
LAST_DAY(date) is a MySQL built-in function that
returns the month-end date from a given date.
For example:
SELECT LAST_DAY('2020-02-14'), LAST_DAY(NOW()), NOW();
-- +------------------------+-----------------+---------------------+
-- | LAST_DAY('2020-02-14') | LAST_DAY(NOW()) | NOW() |
-- +------------------------+-----------------+---------------------+
-- | 2020-02-29 | 2023-11-30 | 2023-11-15 08:33:35 |
-- +------------------------+-----------------+---------------------+
Reference information of the LAST_DAY() function:
LAST_DAY(date): dt Takes a date or datetime value and returns the corresponding value for the last day of the month. Returns NULL if the argument is invalid. Arguments, return value and availability: date: Required. The date to be converted from. dt: Return value. The month-end date. Available since MySQL 4.
⇒ LOCALTIME() - Synonym for NOW()
2023-11-17, 1073🔥, 0💬
Popular Posts:
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simple...
What Is the Difference Between GETDATE() and GETUTCDATE() in SQL Server Transact-SQL? The difference...
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...
What is sqlservr.exe - Process - SQL Server (SQLEX?PRESS) in SQL Server? Process sqlservr.exe is the...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...