Reputation: 243
I have a timestamp value as below:
20171020T222028.026 GMT
I want to convert this to the following format:
2018-12-01 19:35:05
Is this possible in Hive ? Input - 20171020T222028.026 GMT
Output - 2017-10-20 22:20:28
Upvotes: 1
Views: 238
Reputation: 49270
The input format needs to be parsed as shown here. No format parameter is needed for from_unixtime
as the expected output is in the default output format yyyy-MM-dd HH:mm:ss
select from_unixtime(unix_timestamp('20171020T222028.026 GMT',"yyyyMMdd'T'HHmmss.SSS z"))
Formats:
'T'
to escape the literal in the input value.z
for TimezoneUpvotes: 2