I need to transform a column with strings in the following format:
2022-07-08T14:45:04.086Z
2022-07-02T23:23:33.964Z
Using datetime this format works:
datetime.strptime("2022-07-08T14:45:04.001Z","%Y-%m-%dT%H:%M:%S.%fZ")
However, I can´t figure out a way to use pyspark.sql.fuctions.to_date pattern. I tried something like this
df.select(col("modified"),to_date(col("modified"),"yyyy-mm-dd'T'HH:MM:SS.SSSS'Z'").alias("modified2")).show()
Without success.