You are viewing documentation about an older version (1.13.0). View latest version

snowflake.snowpark.functions.next_day¶

snowflake.snowpark.functions.next_day(date: Union[Column, str], day_of_week: Union[Column, None, bool, int, float, str, bytearray, Decimal, date, datetime, time, bytes, list, tuple, dict]) → Column[source]¶

Returns the date of the first specified DOW (day of week) that occurs after the input date.

Example:

>>> import datetime
>>> df = session.create_dataframe([
...     (datetime.date.fromisoformat("2020-08-01"), "mo"),
...     (datetime.date.fromisoformat("2020-12-01"), "we"),
... ], schema=["a", "b"])
>>> df.select(next_day("a", col("b"))).collect()
[Row(NEXT_DAY("A", "B")=datetime.date(2020, 8, 3)), Row(NEXT_DAY("A", "B")=datetime.date(2020, 12, 2))]
>>> df.select(next_day("a", "fr")).collect()
[Row(NEXT_DAY("A", 'FR')=datetime.date(2020, 8, 7)), Row(NEXT_DAY("A", 'FR')=datetime.date(2020, 12, 4))]
Copy