## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> DAYOFYEAR[DAYOFYEAR]:::quoted DAYOFYEAR --> End((END)) ``` ## Purpose The `DAYOFYEAR` SQL function collects the day of a year from a date. Day numbering starts at 1 for January 1. Parameters: - Input (`datetime`): the date/time. Returns: the day of the year as as `int32`. ## Examples The following example retrieves the day number within a week of a date: ```sql select dayofyear(to_date('20260101', 'YYYYMMDD')) ------------------- 1 ``` The following example retrieves the day number within a week of a date: ```sql select dayofyear(to_date('20260101', 'YYYYMMDD')) ------------------- 365 ```