You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Raunak Jhawar <ra...@gmail.com> on 2015/03/24 09:09:48 UTC

Date conversion in Hive

UDF's are great but if you do not want to use one, you can still convert
Long dates into short dates using the set of inbuilt functions.

Thu Mar 19 08:30:06 +0000 2015 (stored as string) can be converted
into 2015-03-19 14:00:06 (stored as date timestamp object - all times
referred from local time zone in Hive)

select created_at,
>
>        unix_timestamp(created_at,"EE MMM dd HH:mm:ss ZZZZ yyyy"),
>
>        from_unixtime(unix_timestamp(created_at,"EE MMM dd HH:mm:ss ZZZZ
>> yyyy"))
>
> from twitter_data limit 10;
>
>
--
Thanks,
Raunak Jhawar