Search code examples
sqlhivetimestampunix-timestamp

Hive: timezone with T to date


I am accessing a hive database where the dates are stored in the following format and as STRING(255)

2014-12-22T00:00:00 

In my SQL I used to the following in the past

where unix_timestamp(creation_date ,'MM/dd/yyyy HH:mm:ss') >= unix_timestamp('01/01/2017 00:00:00','MM/dd/yyyy HH:mm:ss')

Can someone tell me what format the unix_timestamp should be for this timestamp with a T.

Thanks


Solution

  • You can use the below format:

     from_unixtime(unix_timestamp('2014-12-22T00:00:00' , 'yyyy-MM-dd\'T\'HH:mm:ss'))