HIVE 时间操作函数

unix_timestamp:格式化日期转时间戳

hive> select unix_timestamp('2020-08-07 13:24:20','yyyy-MM-dd HH:mm:ss');
1570425860
Time taken: 0.218 seconds, Fetched: 1 row(s)
hive> select unix_timestamp('20200807','yyyyMMdd');
1570377600

from_unixtime:时间戳转格式化日期

hive> select from_unixtime(1570425860,'yyyy-MM-dd HH:mm:ss');
2019-10-07 13:24:20
Time taken: 0.127 seconds, Fetched: 1 row(s)
hive> select from_unixtime(1570425860,'yyyyMMdd000000');
20191007000000

date_format:yyyy-MM-dd HH:mm:ss 时间转格式化时间

hive> select date_format('2019-10-07 13:24:20', 'yyyyMMdd');
20191007
Time taken: 0.123 seconds, Fetched: 1 row(s)
hive> select date_format('2019-10-07 13:24:20', 'yyyy-MM-dd HH:mm:ss');
2019-10-07 13:24:20

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值