Hive中时间日期函数的使用

to_date:日期时间转日期函数
select to_date(‘2015-04-02 13:34:12’);
输出:2015-04-02

from_unixtime:转化unix时间戳到当前时区的时间格式
select from_unixtime(1323308943,’yyyyMMdd’);
输出:20111208

unix_timestamp:获取当前unix时间戳
select unix_timestamp();
输出:1430816254
select unix_timestamp(‘2015-04-30 13:51:20’);
输出:1430373080

year:返回日期中的年
select year(‘2015-04-02 11:32:12’);
输出:2015

month:返回日期中的月份
select month(‘2015-12-02 11:32:12’);
输出:12

day:返回日期中的天
select day(‘2015-04-13 11:32:12’);
输出:13

推荐:oracle 的时间日期转换函数

http://hi.baidu.com/cuigq_hr/blog/item/ba2bc167ed79022eaa184c34.html 1.有sysdate转换后的日期的例子总结: select to_char(sysdate, 'yyyy-mm-dd hh24:mi

hour:返回日期中的小时
select hour(‘2015-04-13 11:32:12’);
输出:11

minute:返回日期中的分钟
select mi

  • 3
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值