Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
This function returns an integer that represents the day (day of the month) of the specified date.
See Date and Time Data Types and Functions (Transact-SQL) for an overview of all Transact-SQL date and time data types and functions.
Transact-SQL syntax conventions
DAY ( date )
date
An expression that resolves to one of the following data types:
For date, DAY
will accept a column expression, expression, string literal, or user-defined variable.
int
DAY returns the same value as DATEPART (day, date).
If date contains only a time part, DAY
will return 1 - the base day.
This statement returns 30
- the number of the day itself.
SELECT DAY('2015-04-30 01:01:01.1234567');
This statement returns 1900, 1, 1
. The date argument has a number value of 0
. SQL Server interprets 0
as January 1, 1900.
SELECT YEAR(0), MONTH(0), DAY(0);
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today