0

I have a table in hive with timestamps (2017-12-12 18:54:03.0) and latitudes/longitudes (e.g. -75.85506)

How can I convert these to approximate local times in hive? I don't need it to be completely accurate - I'm sure daylight savings time makes it tricky

Edit: I need to do this in hive - I see answers in other languages.

OneSolitaryNoob
  • 5,423
  • 3
  • 25
  • 43
  • this is not a duplicate - i need to do this in hive. – OneSolitaryNoob Dec 21 '17 at 21:06
  • Hive does not have such functionality directly, but it if it did it should be put on the list in the dup answer. Instead, you'll need to use the lat/lon data from outside of hive with one of the techniques listed in the dup answer. Put the resulting IANA time zone string (ex `America/Los_Angeles`) into another field in hive. Then you can use Hive's `from_utc_timestamp` function to convert the time stamp from UTC to the local time of the given time zone. – Matt Johnson-Pint Dec 22 '17 at 01:15
  • Alternatively, you can use Hive's ability to call a Java function from within a query, such as with [ReflectUDF](https://cwiki.apache.org/confluence/display/Hive/ReflectUDF). Again, that Java function would have to use one of the techniques listed in the dup answer. – Matt Johnson-Pint Dec 22 '17 at 01:17

0 Answers0