DAY() in MySQL returns the day of the month for a specified date. The day returned will be within the range of 1 to 31. If the given date is ‘2013-03-13’, the function will return 13. The DAYOFMONTH() is the synonym of DAY().
DAY in MySQL Syntax:
1 | DAY(date) |
Here date is any valid date.
EXample :
The following statement will return the day of the month from the specified date.
1 | Select DAY('2014-04-07'); |
Given date format must be in “yyyy/mm/dd” or “yyyy-mm-dd”.
Output:
1 | Output : 7 |
DAY in MySQL is an important function to get the day of a specified date.