You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Tech RJ <co...@gmail.com> on 2012/07/20 23:52:22 UTC

Converting timestamp to date format

What is the difference between these two? Trying to convert timestamps to
full date format. The only difference is BIGINT and INT
*
*
from_unixtime(cast(prod_and_ts.timestamps as *BIGINT*))
*
*
*OR*

from_unixtime(cast(prod_and_ts.timestamps as *INT*))



Which one should I use to get accurate result?

Re: Converting timestamp to date format

Posted by Techy Teck <co...@gmail.com>.
Thanks for the suggestion. I will use BIGINT now.



On Fri, Jul 20, 2012 at 3:48 PM, kulkarni.swarnim@gmail.com <
kulkarni.swarnim@gmail.com> wrote:

> BIGINT is 8 bytes whereas INT is 4 bytes. Timestamps are usually of "long"
> type. To avoid loss of precision, I would recommend BIGINT.
>
>
> On Fri, Jul 20, 2012 at 4:52 PM, Tech RJ <co...@gmail.com> wrote:
>
>> What is the difference between these two? Trying to convert timestamps to
>> full date format. The only difference is BIGINT and INT
>> *
>> *
>> from_unixtime(cast(prod_and_ts.timestamps as *BIGINT*))
>> *
>> *
>> *OR*
>>
>> from_unixtime(cast(prod_and_ts.timestamps as *INT*))
>>
>>
>>
>> Which one should I use to get accurate result?
>>
>>
>>
>>
>>
>
>
> --
> Swarnim
>

Re: Converting timestamp to date format

Posted by "kulkarni.swarnim@gmail.com" <ku...@gmail.com>.
BIGINT is 8 bytes whereas INT is 4 bytes. Timestamps are usually of "long"
type. To avoid loss of precision, I would recommend BIGINT.

On Fri, Jul 20, 2012 at 4:52 PM, Tech RJ <co...@gmail.com> wrote:

> What is the difference between these two? Trying to convert timestamps to
> full date format. The only difference is BIGINT and INT
> *
> *
> from_unixtime(cast(prod_and_ts.timestamps as *BIGINT*))
> *
> *
> *OR*
>
> from_unixtime(cast(prod_and_ts.timestamps as *INT*))
>
>
>
> Which one should I use to get accurate result?
>
>
>
>
>


-- 
Swarnim