MySQL DAYOFMONTH

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

DAYOFMONTH(Date);

MySQL DAYOFMONTH Example

The following query shows you the use of this day of Month method. First, we used the 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');
Example 1

In this Date method example, we are using the NOW(), and CURTIME() functions inside this DAYOFMONTH. From the above MySQL screenshot, it displays today’s day number.

SELECT DAYOFMONTH(NOW()), DAYOFMONTH(CURTIME());
DAYOFMONTH Function 2

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.