Day (expression)

Returns the day portion of expression as an Int32 between 1 and 31.

Arguments

A DateTime and DateTimeOffset.

Return Value

An Int32.

Example

-- The following example returns 12.
Day(cast('03/12/1998' as DateTime))

DayOfYear (expression)

Returns the day portion of expression as an Int32 between 1 and 366, where 366 is returned for the last day of a leap year.

Arguments

A DateTime.

Return Value

An Int32.

Hour (expression)

Returns the year portion of expression as an Int32YYYY.

Arguments

A DateTime and DateTimeOffset.

Return Value

An Int32.

Example

-- The following example returns 1998.
Year(cast('03/12/1998' as DateTime))

Minute (expression)

Returns the minute portion of expression as an Int32 between 0 and 59.

Arguments

A DateTime, Time or DateTimeOffset.

Return Value

An Int32.

Example

-- The following example returns 35
Minute(cast('22:35:5' as DateTime))

Month (expression)

Returns the month portion of expression as an Int32 between 1 and 12.

Arguments

A DateTime or DateTimeOffset.

Return Value

An Int32.

Example

-- The following example returns 3.
Month(cast('03/12/1998' as DateTime))

Second (expression)

Returns the seconds portion of expression as an Int32 between 0 and 59.

Arguments

A DateTime, Time and DateTimeOffset.

Return Value

An Int32.

Example

-- The following example returns 5
Second(cast('22:35:5' as DateTime))

Year (expression)

Returns the year portion of expression as an Int32YYYY.

Arguments

A DateTime and DateTimeOffset.

Return Value

An Int32.

Example

-- The following example returns 1998.
Year(cast('03/12/1998' as DateTime))

Last edited Mar 25, 2013 at 7:34 AM by ansiboy, version 1

Comments

No comments yet.