Reply
New Contributor
Posts: 2
Registered: ‎10-24-2017

Convert Date string with AM PM to timestamp in impala

Hello,
I am trying to convert a date string with AM/PM to timestamp in impala to check data conversion.
My date string is as below:
10/07/2017 02:04:01.575000000 PM

I tried to convert this in Impala through below query:
select from_unixtime(unix_timestamp((Y_date), "MM/dd/yyyy HH:mm:ss.SSSSSSSSS 'ZZ'"), "yyyy-MM-dd HH:mm:ss.SSSSSS 'ZZ'")  from table

The result I get is
2017-10-07 02:04:01.000000 .

I only lose the AM/PM however the hour part "02" is not getting converted to timestamp value "14". I need to get below as result:
2017-10-07 14:04:01.000000 .

Any inputs would be helpful.

Thanks,
Vishu