Reputation: 73
I have a column in Timestamp
format that includes milliseconds.
I would like to reformat my timestamp
column so that it does not include milliseconds. For example if my Timestamp column has values like 2019-11-20T12:23:13.324+0000, I would like my reformatted Timestamp column to have values of 2019-11-20T12:23:13
Is there a straight forward way to perform this operation in spark
-scala
? I have found lots of posts on converting string to timestamp but not for changing the format of a timestamp
.
Upvotes: 0
Views: 1763
Reputation: 770
You can try trunc
.
See more examples: https://sparkbyexamples.com/spark/spark-date-functions-truncate-date-time/
Upvotes: 1