HIve时间函数
1、hive取得当前日期时间:
1.1) 取得当前日期:
select current_date();
1.2) 取得当前日期时间:
select current_timestamp();
1.3) hive取得当前时间戳:
select unix_timestamp();
1.4) 时间戳转日期:
select from_unixtime(1517725479,‘yyyy-MM-dd HH:dd:ss’);
1.5) 日期转unix时间戳:
select to_nuix_timestamp(‘2020-11-11 12:12:12’,‘yyyy-MM-dd HH:dd:ss’);
1.6) hive取得当前时间:
select from_unixtime(unix_timestamp(),‘yyyy-MM-dd HH:dd:ss’);
2、hive自动计算其他日期(昨天,今天):
hive中日期加/减函数:date_

本文介绍了Hive中获取当前日期时间、计算日期差值、字符串转换为日期等时间函数的用法,包括current_date、current_timestamp、date_add、date_sub、from_unixtime、to_date等,并给出了具体的SQL示例。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



