TO_DAY_OF_YEAR
Converts a date or timestamp to a number containing the number for the day of the year.
Syntax
TO_DAY_OF_YEAR(<date>)
Parameter | Description |
---|---|
<date> | An expression that evaluates to a DATE or TIMESTAMP |
Example
This example below finds the day of the year number for April 22, 1975. The string first needs to be transformed to DATE
type using the CAST
function.
SELECT
TO_DAY_OF_YEAR(CAST('1975/04/22' AS DATE)) as res;
Returns: 112