how to convert string to date in spark dataframe using cast code example
Example: spark sql convert string to date
spark.sql("""
SELECT TO_DATE(CAST(UNIX_TIMESTAMP('12/31/2049', 'MM/dd/yyyy') AS TIMESTAMP)) AS newdate"""
).show()
spark.sql("""
SELECT TO_DATE(CAST(UNIX_TIMESTAMP('12/31/2049', 'MM/dd/yyyy') AS TIMESTAMP)) AS newdate"""
).show()