apache - Hive Unix Timestamp -
i'm not getting expected result unix_timestamp of hive
for example :
select from_unixtime(unix_timestamp('2015/02/01', 'yyyy/mm/dd')) table limit 1; output :
2014-12-28 00:00:00 time taken: 0.287 seconds, fetched: 1 row(s) i expected return 2015-02-01 , resulted else. understand because of epoch time ?
you have caps in date format. try using lowercase:
select from_unixtime(unix_timestamp('12/02/01','yyyy/mm/dd') table; results in: 2015-02-01 00:00:00
also can strip off time using:
to_date(from_unixtime(unix_timestamp('12/02/01','yyyy/mm/dd')) results in: 2015-02-01
Comments
Post a Comment