Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize

DAY

SQL Server 2000

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

Syntax

DAY ( date )

Arguments

date

Is an expression of type datetime or smalldatetime.

Return Type

int

Remarks

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

Examples

This 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 this example, the date is specified as a number. Notice that Microsoft® SQL Server™ interprets 0 as January 1, 1900.

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

Here is the result set.

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

See Also

Date and Time Functions

datetime and smalldatetime

Expressions

Show:
© 2014 Microsoft