Support Questions

Find answers, ask questions, and share your expertise

Timestamp in Hive without Timezone

avatar

Is it possible to store the timestamp value in a column in Hive without the timezone part?

For e.g. Oracle supports the timestamp value without a timezone attached to it - https://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm#i1006760

The requirement simply is that store whatever value of the timestamp is given in a column. Currently, Hive automatically applies Day Light Savings adjustment based on the timezone value.

Any inputs are appreciated. Thanks

2 REPLIES 2

avatar
Expert Contributor
@bsaini

Hive always takes timezone into consideration. May be what you want to try is to set that field as String which will retain the same value.

avatar
Master Guru

Hi @bsaini, you can keep it as an int or float representing Unix timestamp in seconds (float if you want to use sub-second units up to nanosec), or a string. From what I see here: Timestamps are interpreted to be timezoneless and stored as an offset from the UNIX epoch. Convenience UDFs for conversion to and from timezones are provided (to_utc_timestamp, from_utc_timestamp).