Date

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.

Example

Creating a table with a Date-type column and inserting data into it:

  1. CREATE TABLE dt
  2. (
  3. `timestamp` Date,
  4. `event_id` UInt8
  5. )
  6. ENGINE = TinyLog;
  1. INSERT INTO dt VALUES (1546300800, 1), ('2019-01-01', 2);
  2. SELECT * FROM dt;
  1. ┌──timestamp─┬─event_id─┐
  2. 2019-01-01 1
  3. 2019-01-01 2
  4. └────────────┴──────────┘

See Also