MySQL LAST_DAY() Function

MySQL | LAST_DAY() Function: Learn about the LAST_DAY() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 08, 2022

LAST_DAY() Function

Whenever you need to find the last day of a particular month or the last day of a particular date then we can use the LAST_DAY() function. This function is used to get the last day of the month according to the date that you have provided.

LAST_DAY() Syntax

SELECT LAST_DAY(date);

LAST_DAY() Parameter(s)

  • date: It only takes one parameter which is the date. You have to provide a valid date. If in case the date is not valid then this function will return you the NULL.

LAST_DAY() Return Value

This function will return you the last day of the date that you have written as a parameter.

MySQL LAST_DAY() Function Example 1

SELECT LAST_DAY('2001-12-08');
Example 1: MySQL LAST_DAY() Function

MySQL LAST_DAY() Function Example 2

SELECT LAST_DAY('2002-02-02');
Example 2: MySQL LAST_DAY() Function

MySQL LAST_DAY() Function Example 3

SELECT LAST_DAY('2002-32-30');
Example 3: MySQL LAST_DAY() Function


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.