I have 2 date format(MM/dd/yy HH:mm and yyyy-mm-dd HH:mm:ss) in start time that needs to convert into yyyy-mm-dd HH:mm format. How do I handle both data format in single below select statement to convert into desired format
df1 = spark.sql("""select from_unixtime(unix_timestamp(strt_tm,'MM/dd/yy HH:mm'),'yyyy-mm-dd HH:mm) as starttime from table1""")
Input
strt_tm
12/11/21 01:15
2021-12-11 11:15:12
output:
strt_tm
2021-12-11 01:15
2021-12-11 11:15