首页 > 其他 > 详细

hive 时间函数

时间:2019-10-15 09:55:58      阅读:110      评论:0      收藏:0      [点我收藏+]

hive 时间函数

20190910


  • 时间截断函数 trunc(string date, string format)返回string
select trunc("2016-06-26","MM") --得到:2016-06-01
select trunc("2016-06-26","YY") --得到:2016-01-01

【注意】 format所支持的格式为MONTH/MON/MM, YEAR/YYYY/YY【大写】

  • timestampdate函数to_date(string timestamp) 返回string
select to_date("1970-01-01 00:00:00") --得到:1970-01-01
  • 时间格式转换date_format(string date, string format)返回string
 select date_format('2015-04-08', 'y') --得到:2015
 select date_format('2015-04-08', 'y-mm') --得到:2015-04
 select date_format('2015-04-08', 'yy-mm') --得到:15-04

【注意】 format所支持的格式为【大写或小写】
【注意】 hive版本是否支持

上面都是参考:Hive2.0函数大全(中文版)

hive 时间函数

原文:https://www.cnblogs.com/damahuhu/p/11675588.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!