问题
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