点击之家:如何将日期转换为长整数?



>我将日期作为字符串字段,形式为'2018-01-02 12:12:22',在ClickHouse SQL中将其转换为长整数时间戳的正确方法是什么?

:) SELECT toUInt64(toDateTime('2018-01-02 12:12:22'));
SELECT toUInt64(toDateTime('2018-01-02 12:12:22'))
┌─toUInt64(toDateTime('2018-01-02 12:12:22'))─┐
│                                  1514884342 │
└─────────────────────────────────────────────┘
1 rows in set. Elapsed: 0.001 sec.

我的查询返回不同的结果

SELECT toUInt64(toDateTime('2018-01-02 12:12:22', 'UTC'))
┌─toUInt64(toDateTime('2018-01-02 12:12:22', 'UTC'))─┐
│                                         1514895142 │
└────────────────────────────────────────────────────┘

最新更新