0
votes

I have a String column from a temp view, were dates values are stored in format of '2020/01/01'. I do need to convert that field to a date value to be stored into a Delta table in 'YYY-MM-DD' format. I've been trying different kind of SQL functions but none of them seems to works, as a result, every function retrieves a null value:

select to_date(dateField, 'yyyy-MM-dd'),
       CAST(dateField as date),
       etc..
from TMP_table

Every function results in a null value, and there's no information about that into Databricks documentation.

1
Tried 'yyyy/DD/mm'? - Usagi Miyamoto
@UsagiMiyamoto that worked! - Kevin Gomez

1 Answers

0
votes

As Usagi said above, select to_date(dateField, 'yyyy/MM/dd') AS date works perfectly.