irpas技术客

HQL时间查询总结(HIVE)_m0_66549962_hql 时间查询

大大的周 1332

--时间格式转为时间戳10位数字,时分秒的跟没有的转换结果不一样 select unix_timestamp('2021-12-03') ---不行,返回结果是null select unix_timestamp('2021-12-03 01:10:00') select unix_timestamp('2021-12-03','yyyy-MM-dd') select unix_timestamp('2021-12-03 01:10:00','yyyy-MM-dd') select unix_timestamp('2021-12-03 01:10:00','yyyy-MM-dd HH:mm:ss')

--时间戳不能加''号/from_unixtime把时间戳转换成时间格式 select from_unixtime(1638465000) select from_unixtime(1638465000,'yyyy-MM-dd') select from_unixtime(1638465000,'yyyy-MM-dd HH:mm:ss')

--转时间戳再转时间格式(转化成其他时间格式) select from_unixtime(1638465000,'yyyyMMdd') select from_unixtime(unix_timestamp('2021-12-03 01:10:00','yyyy-MM-dd HH:mm:ss')) select from_unixtime(unix_timestamp('2021-12-03 01:10:00','yyyy-MM-dd HH:mm:ss'),'yyyyMMdd') select from_unixtime(unix_timest


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #HQL #时间查询 #HIVE时间语句