dayofyear

Return the day of the year

Syntax

dayofyear(dt_expr)

Arguments

dt_expr A date expression.

Description

This function returns the day of the year in the specified date expression as a number between 1 and 366.

The data type DATE assumes the Gregorian calendar even for dates prior to the introduction of the Gregorian calendar. This means that databases that store historical dates prior to the introduction of the Gregorian calendar may not compute SELECT with date ranges, DAYOFWEEK, and WEEK correctly.

Example

select dayofyear("2013-04-17") as "Day of Year";

Day of Year
        107