spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artemis User <arte...@dtechspace.com>
Subject Re: Convert timestamp to unix miliseconds
Date Sat, 07 Aug 2021 14:51:27 GMT
Apparently you were not using the right formatting string.  For 
sub-second formatting, use capital S instead of lower case s.  See 
Spark's doc at 
https://spark.apache.org/docs/latest/sql-ref-datetime-pattern.html. Hope 
this helps...

-- ND

On 8/4/21 4:42 PM, Tzahi File wrote:
> Hi All,
>
> I'm using spark 2.4 and trying to convert a timestamp column to unix 
> with milliseconds using the unix_timestamp function.
>
> I tried to convert the result to double cast(unix_timestamp(timestamp) 
> as double).
> I also tried using the timestamp format "yyyy-MM-dd HH:mm:ss.sss" and 
> no matter what I already tested I just kept getting the unix time in 
> seconds.
>
> Looking for any new ideas.
>
>
> Thanks.


---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscribe@spark.apache.org


Mime
View raw message