Tabular IQ
Back to Function Index

YEAR()

Overview

YEAR() extracts the year component from a date expression and returns it as a numeric value. This function is useful for date-based filtering, grouping, and analysis. If a null date is provided, YEAR() returns zero. The function works with various date formats and is commonly used in conjunction with other date functions.

Function Format

YEAR(date)

Return Value

YEAR() returns an integer

Examples


// Basic year extraction
YEAR(DATE("11/03/2007")) = 2007

// Year from date components
YEAR(DATE(2007, 12, 25)) = 2007

// Additional examples
YEAR(DATE(2024, 1, 1)) = 2024     // Start of year
YEAR(DATE(2024, 12, 31)) = 2024   // End of year
YEAR(NULL) = 0                    // Null date handling
YEAR(DATE(2000, 2, 29)) = 2000    // Leap year

Notes

  • Important behaviors:
    • Returns four-digit year
    • Returns 0 for null dates
    • Works with various date formats
    • Handles leap years correctly
    • Consistent with calendar years
  • Common use cases include:
    • Date filtering
    • Year-based grouping
    • Date analysis
    • Report generation
    • Data aggregation
  • The function is useful for:
    • Year-based calculations
    • Date comparisons
    • Time period analysis
    • Data organization
  • Important considerations:
    • Always returns four digits
    • Works with DATE() function
    • Handles all valid dates
    • Consistent with calendar system

See Also