Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

DAY (Transact-SQL)

Returns an integer representing the day datepart of the specified date.

Topic link icon Transact-SQL Syntax Conventions


DAY ( date )

date

Is an expression of type datetime or smalldatetime.

This function is equivalent to DATEPART(dd, date).

The following example returns the number of the day from the date 03/12/1998.

SELECT DAY('03/12/1998') AS 'Day Number';
GO

Here is the result set.

Day Number 
------------ 
12            

In the following example, the date is specified as a number. The Microsoft SQL Server 2005 Database Engine interprets 0 as January 1, 1900.

SELECT MONTH(0), DAY(0), YEAR(0)

Here is the result set.

----- ------ ------
1     1      1900

Community Additions

ADD
Show:
© 2015 Microsoft