Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

Date32

日期。支持从 0000-01-019999-12-31 的日期范围。以原生字节序存储为有符号 32 位整数,其值表示自 Unix 纪元起的天数:0 表示 1970-01-01,负值表示 1970-01-01 之前的天数。

示例

创建一个包含 Date32 类型列的表,并向其中插入数据:

CREATE TABLE dt32
(
    `timestamp` Date32,
    `event_id` UInt8
)
ENGINE = TinyLog;
-- Parse Date
-- - from string,
-- - from 'small' integer interpreted as number of days since 1970-01-01, and
-- - from 'big' integer interpreted as number of seconds since 1970-01-01.
INSERT INTO dt32 VALUES ('2100-01-01', 1), (47482, 2), (4102444800, 3);

SELECT * FROM dt32;
┌──timestamp─┬─event_id─┐
│ 2100-01-01 │        1 │
│ 2100-01-01 │        2 │
│ 2100-01-01 │        3 │
└────────────┴──────────┘

另见

Navigation