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.
Added in version 3.5.0.
- Parameters:
- days
Columnor column name the target column to work on. A column that evaluates to an integer.
- days
- Returns:
Columnthe date from the number of days since 1970-01-01. Returns a column that evaluates to a date.
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| +---+-----------------------+