How to convert unix timestamp to date in Spark

前端 未结 7 1679
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 11:42

I have a data frame with a column of unix timestamp(eg.1435655706000), and I want to convert it to data with format \'yyyy-MM-DD\', I\'ve tried nscala-time but it doesn\'t w

相关标签:
7条回答
  • 2020-12-01 12:47

    You needn't convert to String before applying toDataTime with nscala_time

    import com.github.nscala_time.time.Imports._

    scala> 1435655706000L.toDateTime
    res4: org.joda.time.DateTime = 2015-06-30T09:15:06.000Z
    

    `

    0 讨论(0)
提交回复
热议问题