SQL Server: DAY Function

DAY function

This SQL Server tutorial explains how to use the DAY function in SQL Server (Transact-SQL) with syntax and examples.


In SQL Server (Transact-SQL), the DAY function returns the day of the month (a number from 1 to 31) given a date value.


The syntax for the DAY function in SQL Server (Transact-SQL) is:

DAY( date_value )

Parameters or Arguments


The date from which to extract the day of the month.


Applies To

The DAY functions can be used in the following versions of SQL Server (Transact-SQL):

  • SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, SQL Server 2005


Let’s look at some SQL Server DAY function examples and explore how to use the DAY functions in SQL Server (Transact-SQL).

For example:

SELECT DAY('2014/04/28');
Result: 28

SELECT DAY('2014/03/31 10:05');
Result: 31

SELECT DAY('2014/04/01 10:05:18.621');
Result: 1

Leave a Reply