snowflake.snowpark.functions.add_months¶
- snowflake.snowpark.functions.add_months(date_or_timestamp: Union[Column, str], number_of_months: Union[Column, int]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L468-L480)¶
Adds or subtracts a specified number of months to a date or timestamp, preserving the end-of-month information.
Example
>>> import datetime >>> df = session.create_dataframe([datetime.date(2022, 4, 6)], schema=["d"]) >>> df.select(add_months("d", 4)).collect()[0][0] datetime.date(2022, 8, 6)