I am trying to figure out, how to extract a date from a datetime value using Pyspark sql.
The datetime values look like this:
DateTime
2018-05-21T00:00:00.000-04:00
2016-02-22T02:00:02.234-06:00
When I now load this into a spark dataframe and try to extract the date (via
Date() or
Timestamp() and then Date()
I always get the error, that a date or timestamp value is expected, but a DateTime value was provided.
Can someone help me with retrieving the date from this value? I think, you need to provide a timezone for that - but since I already had problems extracting only the date, I first wanted to solve this.
Thank you and kind regards.