MySQL DAY() Function

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

DAY() Function

When you want to find out the day part of any date then in such case we can use this DAY() function. This function is used to get the day part from the given date.

DAY() Syntax

SELECT DAY('DATE');

DAY() Parameter(s)

  • DATE: It accepts a date for which you have to get the day of the month.

DAY() Return Value

As a result, it will return you the day part from the date you provided.

MySQL DAY() Function Example 1

SELECT DAY('2022-08-05');
Example 1: MySQL DAY() Function

MySQL DAY() Function Example 2

SELECT DAY('1998-04-25');
Example 2: MySQL DAY() Function

MySQL DAY() Function Example 3

SELECT DAY('1998-04-34');
Example 3: MySQL DAY() Function

Since 34 is not considered a date therefore it shows the NULL. It will only consider the dates ranging from 1 to 31.




Comments and Discussions!

Load comments ↻





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