Date32
一种日期。支持与 DateTime64 相同的日期范围。以原生字节顺序存储为有符号32位整数,值表示自 1900-01-01 起的天数。重要! 0 表示 1970-01-01,负值表示在 1970-01-01 之前的天数。
示例
创建一个包含 Date32 类型列的表并向其中插入数据:
另见
一种日期。支持与 DateTime64 相同的日期范围。以原生字节顺序存储为有符号32位整数,值表示自 1900-01-01 起的天数。重要! 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 │
└────────────┴──────────┘
另见
Was this page helpful?