如何从日期获取bigint?

时间:2019-06-04 01:46:02

标签: presto

运行

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

将向我返回日期表示

enter image description here

然后我想以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

1 个答案:

答案 0 :(得分:4)

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

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