You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by qiaoresearcher <qi...@gmail.com> on 2012/11/22 00:15:11 UTC

how to transform the date format in hive?

Hi All,

Assume we have two time stamp like:    9/15/2002  8:05   and    9/15/2002
9:05

if we need to evaluate the difference of these two time stamp in terms of
hours ( or minutes ), how to do that?

Hive seems only support the format  'yyyy-MM-dd HH:mm:ss' , how can we
transform the two time stamps into the format that can be processed by
hive?

thanks for any suggestion in advance.

Re: how to transform the date format in hive?

Posted by Ruslan Al-Fakikh <me...@gmail.com>.
Hi, also take a look at Hive date functions:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-DateFunctions


On Thu, Nov 22, 2012 at 3:59 AM, Tom Hubina <to...@z2live.com> wrote:

> Could convert them to unix time which will give you two bigints that you
> can subtract to get seconds, and divide result by 60 to get minutes, etc.
>
> Tom
>
>
> On Wed, Nov 21, 2012 at 3:15 PM, qiaoresearcher <qi...@gmail.com>wrote:
>
>> Hi All,
>>
>> Assume we have two time stamp like:    9/15/2002  8:05   and    9/15/2002
>>   9:05
>>
>> if we need to evaluate the difference of these two time stamp in terms of
>> hours ( or minutes ), how to do that?
>>
>> Hive seems only support the format  'yyyy-MM-dd HH:mm:ss' , how can we
>> transform the two time stamps into the format that can be processed by
>> hive?
>>
>> thanks for any suggestion in advance.
>>
>>
>>
>

Re: how to transform the date format in hive?

Posted by Tom Hubina <to...@z2live.com>.
Could convert them to unix time which will give you two bigints that you
can subtract to get seconds, and divide result by 60 to get minutes, etc.

Tom

On Wed, Nov 21, 2012 at 3:15 PM, qiaoresearcher <qi...@gmail.com>wrote:

> Hi All,
>
> Assume we have two time stamp like:    9/15/2002  8:05   and    9/15/2002
>   9:05
>
> if we need to evaluate the difference of these two time stamp in terms of
> hours ( or minutes ), how to do that?
>
> Hive seems only support the format  'yyyy-MM-dd HH:mm:ss' , how can we
> transform the two time stamps into the format that can be processed by
> hive?
>
> thanks for any suggestion in advance.
>
>
>