Tabular IQ
Back to Function Index

MONTH()

Overview

MONTH() extracts the month component from a date expression, returning it as an integer between 1 and 12. This function is useful for date-based calculations, filtering, and reporting where you need to work with the month portion of a date value.

Function Format

MONTH(date)

Return Value

MONTH() returns an integer between 1 and 12, or 0 for NULL dates

Examples


MONTH(DATE("11/22/2007")) = 11          (November)
MONTH(DATE(2007, 7, 4)) = 7             (July)
MONTH(DATE("2025-01-01")) = 1           (January)
MONTH(DATE("2025-12-31")) = 12          (December)
MONTH(CURDATE()) = 3                     (if run in March)
MONTH(NULL) = 0                          (NULL handling)

Notes

  • Important behaviors:
    • Returns an integer between 1 and 12
    • Returns 0 for NULL input
    • Works with various date formats
    • Preserves the exact month value
    • Ignores time components
  • Common use cases include:
    • Date-based filtering
    • Monthly reporting
    • Seasonal analysis
    • Date calculations
    • Data grouping by month
  • The function can be used with:
    • Date literals
    • Date columns
    • Date functions
    • Date expressions
  • This function is often used in combination with other date functions like YEAR(), DAY(), and DATEPART() for more complex date manipulations.
  • For extracting other date components, use YEAR() or DAY() functions.

See Also