I have a column Time
in my spark df. It is a string type. I need to convert it to datetime format. I have tried the following:
data.select(unix_timestamp(data.Time, 'yyyy/MM/dd HH:mm:ss').cast(TimestampType()).alias("timestamp"))
data.printSchema()
The output is:
root
|-- Time: string (nullable = true)
If I save it in a new df, then I am losing all of my other columns.