I have a date column in string. Date is as follows: SinkCreatedOn = 7/30/2022 5:21:55 PM
I am trying to parse to datetype using following code but always get null values. I have tried many different specific date formats i.e M/d/y as it says in new spark documentation
df = df.withColumn("test", F.to_date(F.to_timestamp(col("SinkCreatedOn"), "MM/dd/yyyy HH:mm:ss a")))
test returns null
I tried this code on a column that only included date and it worked. When timestamp is present it breaks.
Any help much appreciated
Thank you