Name

DAY()

Synopsis

DAY(date)

This function returns the day of the month for a given date. It’s available as of version 4.1.1 of MySQL and is synonymous with the DAYOFMONTH() function, described later. Here is an example:

SELECT DAY('2008-12-15')
AS 'Day';

+-------+
| Day   |
+-------+
|    15 |
+-------+

This function is more meaningful when applied to a date column where the date is unknown before entering the SQL statement.

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.