Hive - UNIX_TIMESTAMP Quandary [英] Hive - UNIX_TIMESTAMP Quandary
问题描述
以下是我的1行数据(为简洁起见):
73831 12/26/2014 1:00:00 AM 0.3220
第二栏是时间
字符串格式的列。我使用这个配置单元查询:
$ p $ select col2,UNIX_TIMESTAMP(col2,'MM / DD / YYYY hh:mm:ss aaa')from Table
以下是我得到的结果: 1388296800
然而,当我检查时, http: //www.epochconverter.com/ 以及 from_unixtime(1388296800)
,我会得到不同的日期。
我在格式/模式字符串中输入 UNIX_TIMESTAMP
在Hive中有什么问题吗?
您的日期格式符号需要符合Java SimpleDateFormat文档。
你的日期看起来像你想要的 MM / dd / yyyy HH :mm:ss aa
。
Here is my 1 line of data (for brevity):
73831 12/26/2014 1:00:00 AM 0.3220
The 2nd column is the time
column which is in string format. I'm using this hive query:
select col2, UNIX_TIMESTAMP(col2,'MM/DD/YYYY hh:mm:ss aaa') from Table
Here is what I get: 1388296800
However, when I check with, http://www.epochconverter.com/ and also from_unixtime(1388296800)
, I get a different date.
Is there something wrong with my format / pattern string I enter into UNIX_TIMESTAMP
in Hive?
Your date format symbols need to conform to those in the Java SimpleDateFormat documentation.
For your date it looks like you want MM/dd/yyyy HH:mm:ss aa
.
这篇关于Hive - UNIX_TIMESTAMP Quandary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!