Search code examples
hiveprestotrino

date_add for timestamp in Hive


im currently running a query in presto db which has a condition like below:

x.created_date > date_add('day',-15,y.arrival_timestamp )

I plan to move the query to hive and want to know what is the alternative to get the comparision to work exactly as above, when i run the query in Hive

Created_date sample value 2020-12-04T15:47:15.497000

arrival_timestamp sample value 2020-11-24T21:08:20.046000

Any help would be appreciated.Thank you


Solution

  • You can use date_sub in Hive:

    x.created_date > date_sub(y.arrival_timestamp, 15)