Hive - UNIX_TIMESTAMP Quandary

。_饼干妹妹 提交于 2019-12-25 03:32:59

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/28884963/hive-unix-timestamp-quandary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!