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.
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 | ----------------
- 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