Reputation: 1
I am trying to convert date in format YYYYMMDD in hive to unix_timestamp but when I do below, I am getting incorrect timestamp.
select unix_timestamp(DATE,'YYYYMMDD') from table_name.
For '20180301'
I am getting unix timestamp output as '1514631600'
which is DECEMBER 30,2017 11:59 pm
Upvotes: 0
Views: 9121
Reputation: 49260
The format string should be yyyyMMdd
.
select unix_timestamp(DATE,'yyyyMMdd') from table_name
Upvotes: 1