I have dataframe with two string columns c1dt and c2tm and it's format is yyyymmdd and yyyymmddTHHmmss.SSSz respectively. Now I want to convert these columns into date type and timestamp type columns and I tried the following but it doesn't work it shows columns values as null.
val newdf = df.withColumn("c1dt", unix_timestmap("c1dt","yyyymmdd").cast("date").withColumn("c2tm","yyyymmddTHHmmss.SSSz").cast("timestamp"))
When I call newdf.show both columns values show as null. If I print original dataframe df I see date and timestamp values.