I am trying to covert string column in dataframe to date/time. I am loading dataframe from hive tables and i have tried below mentioned function in converting string to date/time. But it is not giving me the correct output as it is converting all values to null.
(unix_timestamp($"BIRTHDT","MM-dd-yyyy").cast("date")) &&
(to_date(($"BIRTHDT","MM-dd-yyyy").cast("date"))
Values in my birthdt columns are as follows
20061202
20061203
20061205
20061206
20061208
Am i missing something?
Thanks
Rahul