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

snowflake.snowpark.functions.dateadd¶

snowflake.snowpark.functions.dateadd(part: str, col1: ColumnOrName, col2: ColumnOrName) → Column[source]¶

Adds the specified value for the specified date or time part to date or time expr.

Supported date and time parts

Example:

>>> # add one year on dates
>>> import datetime
>>> date_df = session.create_dataframe([[datetime.date(2020, 1, 1)]], schema=["date_col"])
>>> date_df.select(dateadd("year", lit(1), col("date_col")).alias("year_added")).show()
----------------
|"YEAR_ADDED"  |
----------------
|2021-01-01    |
----------------
Copy
Parameters:
  • part – The time part to use for the addition

  • col1 – The first timestamp column or addend in the dateadd

  • col2 – The second timestamp column or the addend in the dateadd