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

snowflake.snowpark.functions.date_add

snowflake.snowpark.functions.date_add(col: Union[Column, str], num_of_days: Union[Column, str, int])[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L4142-L4171)

Adds a number of days to a date column.

Parameters:
  • col – The column to add to.

  • num_of_days – The number of days to add.

Example:

>>> from snowflake.snowpark.functions import date_add, to_date
>>> df = session.createDataFrame([("1976-01-06")], ["date"])
>>> df = df.withColumn("date", to_date("date"))
>>> res = df.withColumn("date", date_add("date", 4)).show()
--------------
|"DATE"      |
--------------
|1976-01-10  |
--------------
Copy
Language: English