You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by pseudo oduesp <ps...@gmail.com> on 2016/06/01 11:16:07 UTC

hivecontext and date format

Hi ,
can i ask you how we can convert string like dd/mm/yyyy to date type in
hivecontext?

i try with unix_timestemp and with format date but i get null .
thank you.

Re: hivecontext and date format

Posted by Mich Talebzadeh <mi...@gmail.com>.
Try this

SELECT

TO_DATE(FROM_UNIXTIME(UNIX_TIMESTAMP(paymentdate,'dd/MM/yyyy'),'yyyy-MM-dd'))
AS paymentdate
FROM

HTH

Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*



http://talebzadehmich.wordpress.com



On 1 June 2016 at 12:16, pseudo oduesp <ps...@gmail.com> wrote:

> Hi ,
> can i ask you how we can convert string like dd/mm/yyyy to date type in
> hivecontext?
>
> i try with unix_timestemp and with format date but i get null .
> thank you.
>