snowflake.snowpark.functions.daydiff

snowflake.snowpark.functions.daydiff(col1: Union[Column, str], col2: Union[Column, str]) Column[source]

Calculates the difference between two dates, or timestamp columns based in days. The result will reflect the difference between col1 - col2

Example::
>>> from snowflake.snowpark.functions import daydiff, to_date
>>> df = session.createDataFrame([("2015-04-08", "2015-05-10")], ["d1", "d2"])
>>> res = df.select(daydiff(to_date(df.d2), to_date(df.d1)).alias("diff")).show()
----------
|"DIFF"  |
----------
|32      |
----------
Copy