Skip to content
ClickHouse Docs
ClickHouse DocsClickHouse Docs

Date32

日付を表します。0000-01-01 から 9999-12-31 までの日付範囲をサポートします。値は Unix epoch からの日数を表し、native バイト順序の符号付き 32 ビット整数として格納されます。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