Hive 中 时间戳,字符串转换
时间:2020-08-29 18:49:25
收藏:0
阅读:1688
13位时间戳装换为日期格式的字符串
select from_unixtime( cast(1597651229344/1000 as int),‘yyyy-MM-dd HH:mm:ss‘)
时间字符串比较大小
使用函数:STR_TO_DATE(str, format)
使用示例:select * from h_hotelcontext where now() between STR_TO_DATE(Start_time,‘%Y-%m-%d %H:%i:%s‘) and STR_TO_DATE(End_time,‘%Y-%m-%d %H:%i:%s‘);
使用注意点:format的格式为%Y-%m-%d %H:%i:%s ,中间的分隔符也需要跟你传入的字符串格式对上
原文:https://www.cnblogs.com/yangxusun9/p/13566803.html
评论(0)