Hive支持使用内置的函数来处理时间戳。以下是一些常用的时间戳转换函数:
示例:
SELECT from_unixtime(1632988800) as timestamp;
示例:
SELECT to_unixtime(unix_timestamp('2021-10-01 00:00:00')) as timestamp;
示例:
SELECT from_utc_timestamp(unix_timestamp('2021-10-01 00:00:00'), 'yyyy-MM-dd HH:mm:ss') as timestamp;
示例:
SELECT to_utc_timestamp('2021-10-01 00:00:00', 'yyyy-MM-dd HH:mm:ss') as timestamp;
示例:
SELECT date_format(unix_timestamp('2021-10-01 00:00:00'), 'yyyy-MM-dd HH:mm:ss') as timestamp;
示例:
SELECT unix_timestamp('2021-10-01 00:00:00') as timestamp;
示例:
SELECT timestamp(1632988800) as timestamp;
请根据您的需求选择合适的函数进行时间戳转换。