Hi I am trying to change datatype of DOB column from stringtype to DateType but getting issue

parakh17
New Contributor

Hi I am trying to change datatype of DOB column from String type to DateType but getting issue
"SparkUpgradeException: [] You may get a different result due to the upgrading to Spark >= 3.0: Caused by: DateTimeParseException: Text '7/8/1972' could not be parsed at index 0"

I have attached screenshots for your reference. Can someone help. I know this is a silly doubt but help is really appreciated ! Thanks in advance


Screenshot 2024-06-30 at 6.50.42 PM.pngScreenshot 2024-06-30 at 6.50.57 PM.pngScreenshot 2024-06-30 at 6.51.01 PM.png

Witold
Databricks Partner

It's because the format you're using it wrong. Use `'M/d/yyyy'` instead.