I have a spark dataframe.
root
|-- col1: string (nullable = true)
|-- Id: string (nullable = true)
|-- col2: string (nullable = true)
|-- col3: string (nullable = true)
|-- col4: string (nullable = true)
|-- date1: string (nullable = true)
|-- col5: string (nullable = true)
|-- date2: string (nullable = true)
I just want to convert the date2 column to date. I used the below code to do that
to_date(myDF$date2)
But the dataframe remains the same. No change in date2 datatype.
How can I change the column date2 to date dataType?
myDF$date2 <- to_date(myDF$date2)