In pyspark is there a way to convert a dataframe column of timestamp datatype to a string of format 'YYYY-MM-DD' format?
You can use date_format function as below
from pyspark.sql.functions import date_format
df.withColumn("dateColumn", date_format(col("vacationdate"), "yyyy-MM-dd"))
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With