HIVE from.unixtime(...) with Time Zone

Viewed 284

I set up my Hive in a machine with GMT+8 time zone. Therefore, from_unixtime(946656000) returns 2000-01-01 00:00:00 instead of 1999-12-31 16:30:00. According to the manual, this function returns the date string using the current system time zone. What can I do to get a date string with UTC time zone i.e. 1999-12-31 16:30:00?

1 Answers

You can use to_utc_timestamp(T timestamp, STRING timezone). Here is an example where a timestamp in IST is converted to UTC.

select TO_UTC_TIMESTAMP(from_unixtime(946656000),'IST') c

enter image description here

Related