我有一个sparkDataframe,在epoche之后有一个以毫秒为单位的timestamp列。列是一个字符串。我现在想将列转换为可读的人类时间,但保留毫秒。例如:
1614088453671 -> 23-2-2021 13:54:13.671
我发现的每个例子都会将时间戳转换为正常的人类可读时间,而不需要毫秒。
我所拥有的:
+------------------+
|epoch_time_seconds|
+------------------+
|1614088453671 |
+------------------+
我想达到的目标:
+------------------+------------------------+
|epoch_time_seconds|human_date |
+------------------+------------------------+
|1614088453671 |23-02-2021 13:54:13.671 |
+------------------+------------------------+
1条答案
按热度按时间0vvn1miw1#
使用获取毫秒之前的时间
date_format from_unixtime
,而毫秒可以使用模来获得。结合他们使用format_string
.