pyspark.sql.functions.date_from_unix_date#
- pyspark.sql.functions.date_from_unix_date(days)[source]#
Create date from the number of days since 1970-01-01.
New in version 3.5.0.
- Parameters
- days
Column
or column name the target column to work on.
- days
- Returns
Column
the date from the number of days since 1970-01-01.
Examples
>>> import pyspark.sql.functions as sf >>> spark.range(4).select('*', sf.date_from_unix_date('id')).show() +---+-----------------------+ | id|date_from_unix_date(id)| +---+-----------------------+ | 0| 1970-01-01| | 1| 1970-01-02| | 2| 1970-01-03| | 3| 1970-01-04| +---+-----------------------+