A date. Stored in two bytes as the number of days since 1970-01-01 (unsigned). Allows storing values from just after the beginning of the Unix Epoch to the upper threshold defined by a constant at the compilation stage (currently, this is until the year 2149, but the final fully-supported year is 2148).
The date value is stored without the time zone.
1. Creating a table with a
DateTime-type column and inserting data into it:
CREATE TABLE dt ( `timestamp` Date, `event_id` UInt8 ) ENGINE = TinyLog;
INSERT INTO dt Values (1546300800, 1), ('2019-01-01', 2);
SELECT * FROM dt;
┌──timestamp─┬─event_id─┐ │ 2019-01-01 │ 1 │ │ 2019-01-01 │ 2 │ └────────────┴──────────┘
- Functions for working with dates and times
- Operators for working with dates and times