SQL Server Date Function DAY()

www.igi‮aeditf‬.com

The DAY() function in SQL Server is used to extract the day of the month from a given date or datetime value. It takes one argument, which is the date or datetime value to extract the day from.

The syntax of the DAY() function is as follows:

DAY(date)

Here's an example of how to use the DAY() function in a SQL query to extract the day of the month from a date value:

SELECT DAY('2022-02-28');

This query will return the integer value 28, which is the day of the month in the date.

In this example, the date is "2022-02-28", which is the date to extract the day from.

Note that the DAY() function is specific to SQL Server and the syntax and date format it supports may vary slightly depending on the system. Additionally, the DAY() function only extracts the day of the month and cannot be used to extract other parts of the date or datetime value.