Date
Date represents a Gregorian calendar date without a time of day or timezone. Its supported range is 1970-01-01 through 2149-06-06, inclusive.
Syntax
text
DateInput and conversion
Text input uses YYYY-MM-DD and must be a valid date within the supported range. Integer input is the number of days since 1970-01-01.
Casting a date to INTEGER returns its epoch-day count. Adding or subtracting an integer moves the date by that many days. Use an Interval for calendar-month or year arithmetic.
A Date compared with a timestamp represents midnight in the timestamp's timezone. Native date values cannot be summed directly; convert them explicitly when a numeric calculation is intended.
Examples
Creating a date column
sql
CREATE TABLE events(id UInt32, day Date);
INSERT INTO events VALUES (1, '2025-03-05');sql
SELECT id, day, day + 1 AS next_day
FROM events
FORMAT csv;text
1,"2025-03-05","2025-03-06"Converting epoch days
sql
SELECT CAST(1 AS Date),
CAST(CAST('1970-01-02' AS Date) AS INTEGER)
FORMAT csv;text
"1970-01-02",1See Date32 for the alternative date range, and DateTime for whole-second timestamps.