MySQL DAYOFMONTH

MySQL DAYOFMONTH function is one of the MySQL Date Functions, which returns the Day Number of the given date or an expression. The syntax of the Day Of Month Function in MySQL is as shown below:

DAYOFMONTH(Date);

MySQL DAYOFMONTH Example

The following query shows you the use of this MySQL day of Month function. First, we used date expression inside this DAYOFMONTH function. Next, we used the Date and Time expression. Both these statements return the Day number from the given dates.

SELECT DAYOFMONTH('2018-11-04');

SELECT DAYOFMONTH('2017-09-16 01:14:22');
MySQL DAYOFMONTH Function 2

In this Date Function example, we are using the NOW(), and CURTIME() functions inside this DAYOFMONTH function.

SELECT DAYOFMONTH(NOW()), DAYOFMONTH(CURTIME());
MySQL DAYOFMONTH Function 3

From the above MySQL screenshot, it displays today’s day number.