Tabular IQ
Back to Function Index

DATE()

Overview

DATE() is a versatile function that can be used in two ways: to create a date from individual components (year, month, day) or to convert a string expression to a date. The function supports multiple date formats and can also handle special cases like Julian dates and Unix timestamps.

Function Format

DATE(year, month, day [, hour, minute, second])
DATE(string)
DATE(string, conversion_mapping_string)

Return Value

DATE() returns a date value

Examples


DATE(2025, 12, 25)                    = 2025-12-25
DATE(2025, 12, 25, 8, 15, 30)         = 2025-12-25 08:15:30
DATE("12/25/2025")                    = 2025-12-25
DATE("2025-12-25")                    = 2025-12-25
DATE(0, 0, 0) + 2461234               = 2025-03-26
DATE(1741234567 * 1000)               = 2025-03-26
DATE("20251225", "YYYYMMDD")          = 2025-12-25
DATE("2025-25-12", "YYYYDDMM")        = 2025-12-25
DATE("12252025", "MMDDYYYY")          = 2025-12-25
DATE("12/25/2025", "MM/DD/YYYY")      = 2025-12-25

Notes

  • Supported date formats:
    • MM/DD/YYYY or MM-DD-YYYY
    • YYYY/DD/MM or YYYY-DD-MM
    • DDMMYYYY
    • YYYYDDMM
    • MMYYYYDD
    • DDYYYYMM
  • Special cases:
    • Julian dates: Use DATE(0,0,0) + julian_number
    • Unix timestamps: Use DATE(timestamp * 1000) for seconds
  • Common use cases:
    • Date filtering in queries
    • Date conversion from various formats
    • Date arithmetic operations
    • Timestamp conversions
  • When using string conversion, the format string must match the input string format exactly.
  • Time components are optional when creating dates from components.

See Also