Which function is used to return the day of the month in SQL?

DAY() function, in SQL Server is used to return the day of the month i.e, from 1st to 31st for date stated.

Features :

  • This function is used to find the day of the month for a date specified.
  • This function comes under Date Functions.
  • This function accepts only one parameter i.e, date.
  • This function can also include time with the stated date.

Syntax :

DAY(date)

Parameter :

This method accepts only one parameter as given below as follows.

  • date –Specified date from which the day of the month is to be returned.

Returns : It returns the day of the month i.e, from 1st to 31st for a date specified.

Example: Using DAY() function and getting the day of the month from the date specified.

SELECT DAY('2020/01/02');

Output :

2