I have two columns which are in string
but need to be converted into a datetime
or date and time.
- Column1: 20190828T121539.000000+0200
- Column2: 20190828T121539.000+0200
How can I do this?
I used:
.withColumn('test', from_unixtime(unix_timestamp('Column1', 'yyyyMMddThhmmss'))
but doesn't seem to work
I've solved it with this:
to_timestamp(col('EventDateTime').substr(1,15), "yyyyMMdd'T'HHmmss")
The last part of the value was irrelevant so I could use a substr