Tabular IQ
Back to Function Index

DAY()

Overview

DAY() extracts the day of the month from a date expression, returning it as an integer between 1 and 31. This function is useful for date-based calculations, filtering, and reporting where you need to work with specific days of the month.

Function Format

DAY(date)

Return Value

DAY() returns an integer between 1 and 31, or 0 for NULL dates

Examples


DAY(DATE("12/25/2025"))           = 25
DAY(DATE(2025, 12, 25))          = 25
DAY(DATE("2025-01-01"))          = 1
DAY(DATE("2025-02-28"))          = 28
DAY(DATE("2025-03-31"))          = 31
DAY(CURDATE())                   = 19  (if run on March 19, 2025)
DAY(NULL)                        = 0

Notes

  • The function returns an integer between 1 and 31, representing the day of the month.
  • If the input date is NULL, the function returns 0.
  • Common use cases include:
    • Date-based filtering (e.g., all records from the 15th of each month)
    • Date arithmetic and calculations
    • Reporting and analytics
    • Date validation
  • The function can be used with any valid date expression, including:
    • Date literals
    • Date columns
    • Date functions
    • Date arithmetic expressions
  • This function is equivalent to EXTRACT(DAY FROM date) in some database systems.

See Also