pyspark.sql.functions.next_day

pyspark.sql.functions.next_day(date: ColumnOrName, dayOfWeek: str) → pyspark.sql.column.Column[source]

Returns the first date which is later than the value of the date column.

Day of the week parameter is case insensitive, and accepts:

“Mon”, “Tue”, “Wed”, “Thu”, “Fri”, “Sat”, “Sun”.

New in version 1.5.0.

Examples

>>> df = spark.createDataFrame([('2015-07-27',)], ['d'])
>>> df.select(next_day(df.d, 'Sun').alias('date')).collect()
[Row(date=datetime.date(2015, 8, 2))]