pyspark.sql.functions.date_add¶
-
pyspark.sql.functions.
date_add
(start: ColumnOrName, days: Union[ColumnOrName, int]) → pyspark.sql.column.Column¶ Returns the date that is days days after start
Examples
>>> df = spark.createDataFrame([('2015-04-08', 2,)], ['dt', 'add']) >>> df.select(date_add(df.dt, 1).alias('next_date')).collect() [Row(next_date=datetime.date(2015, 4, 9))] >>> df.select(date_add(df.dt, df.add.cast('integer')).alias('next_date')).collect() [Row(next_date=datetime.date(2015, 4, 10))]