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

snowflake.snowpark.functions.next_day

snowflake.snowpark.functions.next_day(date: ColumnOrName, day_of_week: ColumnOrLiteral) 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