day

Description

Returns an integer that represents the day in the datepart of a specified date.

Syntax

day(date_expression)

Parameters

date_expression

is an expression of type datetime, smalldatetime, date or a character string in a datetime format.

Examples

Example 1

Returns the integer 02:

day("11/02/03")
----------
02

Usage

day(date_expression) is equivalent to datepart(dd,date_expression).

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute day.

See also

Datatypes datetime, smalldatetime, date, time

Functions datepart, month, year