Summary: this tutorial introduces you to the MySQL
LAST_DAY()
function and shows you how to apply the LAST_DAY()
function in various contexts.
Introduction to MySQL LAST_DAY()
function
The
LAST_DAY()
function takes a DATE
or DATETIME
value and returns a value corresponding to the last day of the month.
The date argument must be a valid
DATE
or DATETIME
value.
MySQL LAST_DAY()
function examples
The following example returns the last day of
February 03, 2016
.
To get the last day of the current month, you combine the
LAST_DAY()
function with the NOW()
or CURDATE()
function as follows:
To get the last day of the next month, you add 1 month to the current date and apply the
LAST_DAY()
function:
0 Comments