invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

MONTH

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> MONTH[MONTH]:::quoted
    MONTH --> End((END))

Purpose

The MONTH SQL function extracts the months from a date/time.

See also DAY, HOUR, MICROSECOND, MILLISECOND, MINUTE, SECOND and YEAR.

Parameters:

  • Input (datetime): the date/time to extract the months from.

Returns: the month as an int32.

Examples

The following example extracts the months from current system date/time in UTC:

select month(sysdateutc)

-------------------
6

The following example extracts the months from May 1, 2026:

select month(to_date('20260501', 'YYYYMMDD'))

-------------------
5