## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> DAY[DAY]:::quoted DAY --> End((END)) ``` ## Purpose The `DAY` SQL function collects the day number within a month from a date. See also [[HOUR]], [[MICROSECOND]], [[MILLISECOND]], [[MINUTE]], [[MONTH]], [[SECOND]] and [[YEAR]]. Parameters: - Input (`datetime`): the date/time. Returns: the day as `int32`. ## Examples The following example retrieves the day number within a month of a date: ```sql select day(to_date('20260603', 'YYYYMMDD')) ------------------- 3 ``` The following example retrieves the day number within a month of a date: ```sql select day(to_date('20260531', 'YYYYMMDD')) ------------------- 31 ```