如何在 Hive 中获取当前的 unix 纪元
How to get current unix epoch in Hive
这是 unix_timestamp()
提供的功能,但已被弃用。
select unix_timestamp() from table_name limit 1;
unix_timestamp(void) is deprecated. Use current_timestamp instead.
OK
1553706841
它建议改用current_timestamp()
,但它没有给出纪元时间:
select current_timestamp() from table_name limit 1;
OK
2019-03-27 13:14:21.767
获取当前 unix 纪元时间的推荐方法是什么?
您可以使用 unix_timestamp
和字符串格式的 datetime/date 参数来获取纪元。
select unix_timestamp(current_timestamp())
请注意,自 2.0 版以来不推荐使用不带参数的 unix_timestamp
函数,而不是 unix_timestamp(string date)
。
这是 unix_timestamp()
提供的功能,但已被弃用。
select unix_timestamp() from table_name limit 1;
unix_timestamp(void) is deprecated. Use current_timestamp instead.
OK
1553706841
它建议改用current_timestamp()
,但它没有给出纪元时间:
select current_timestamp() from table_name limit 1;
OK
2019-03-27 13:14:21.767
获取当前 unix 纪元时间的推荐方法是什么?
您可以使用 unix_timestamp
和字符串格式的 datetime/date 参数来获取纪元。
select unix_timestamp(current_timestamp())
请注意,自 2.0 版以来不推荐使用不带参数的 unix_timestamp
函数,而不是 unix_timestamp(string date)
。