month

datetime

Extracts the month from a date or timestamp

Syntax

month(date)

Parameters

date (date|timestamp)

The date value to extract the month from

Returns

number

The month as a number (1-12)

Examples

Input:
month("2024-03-15")
Output:
3
Get the current month
Input:
month(now())
Output:
12
Extract month from a timestamp field
Input:
.timestamp | month
Output:
1

The month() function extracts the month component from a date or timestamp value, returning a number from 1 (January) to 12 (December).

Usage

Use month() to group data by month, filter records by specific months, or extract temporal components for seasonal analysis.