from_unixtime 给了我一个尴尬的值

from_unixtime gave me an awkward value

您好,我用 from_unixtime 转换了这个值 1632837232439,我得到了 53712-07-21 01:53:59 这样对吗?我无法理解这一点,我使用了

df = df.select(from_unixtime(df_sixty60['createdOn']).alias("date_key"))

感谢您的帮助,即使您可以提出其他表示方式。谢谢

尝试使用 to_timestamp() 函数和 divide by 1000 因为你的纪元时间戳包含毫秒。

Example:

df.show()
#+-------------+
#|    createdOn|
#+-------------+
#|1632837232439|
#+-------------+ 

df.select(to_timestamp(df['createdOn']/1000).alias("date_key")).show(10,False)

#+-----------------------+
#|date_key               |
#+-----------------------+
#|2021-09-28 13:53:52.439|
#+-----------------------+