如何从日期中获取 bigint?

How to obtain a bigint from a date?

运行它

SELECT timestamp '2019-6-2 00:00 UTC'

将 return 日期表示给我

那我想把它作为bigint获取,

SELECT cast(timestamp '2019-6-2 00:00 UTC' as bigint)

我遇到了这个错误

Query failed (#20190604_014249_16755_mru2t): line 1:8: Cannot cast timestamp with time zone to bigint

你想要什么bigint?一个合理的答案是 unix 时间戳:

select cast(to_unixtime(timestamp '2019-6-2 00:00 UTC') as bigint)