You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Andy Davidson <An...@SantaCruzIntegration.com> on 2016/03/22 00:19:28 UTC

pyspark sql convert long to timestamp?

Any idea how I have a col in a data frame that is of type long any idea how
I create a column who¹s type is time stamp?

The long is unix epoch in ms

Thanks

Andy



Re: pyspark sql convert long to timestamp?

Posted by Andy Davidson <An...@SantaCruzIntegration.com>.
Thanks

createdAt is a long

from_unixtime(createdAt / 1000, 'yyyy-MM-dd HH:mm:ss z') as fromUnix,

Worked


From:  Akhil Das <ak...@sigmoidanalytics.com>
Date:  Monday, March 21, 2016 at 11:56 PM
To:  Andrew Davidson <An...@SantaCruzIntegration.com>
Cc:  "user @spark" <us...@spark.apache.org>
Subject:  Re: pyspark sql convert long to timestamp?

> Have a look at the from_unixtime() functions.
> https://spark.apache.org/docs/1.5.0/api/python/_modules/pyspark/sql/functions.
> html#from_unixtime
> 
> Thanks
> Best Regards
> 
> On Tue, Mar 22, 2016 at 4:49 AM, Andy Davidson <An...@santacruzintegration.com>
> wrote:
>> Any idea how I have a col in a data frame that is of type long any idea how I
>> create a column who¹s type is time stamp?
>> 
>> The long is unix epoch in ms
>> 
>> Thanks
>> 
>> Andy
> 



Re: pyspark sql convert long to timestamp?

Posted by Akhil Das <ak...@sigmoidanalytics.com>.
Have a look at the from_unixtime() functions.
https://spark.apache.org/docs/1.5.0/api/python/_modules/pyspark/sql/functions.html#from_unixtime

Thanks
Best Regards

On Tue, Mar 22, 2016 at 4:49 AM, Andy Davidson <
Andy@santacruzintegration.com> wrote:

> Any idea how I have a col in a data frame that is of type long any idea
> how I create a column who’s type is time stamp?
>
> The long is unix epoch in ms
>
> Thanks
>
> Andy
>