snowflake.snowpark.functions.daydiff

snowflake.snowpark.functions.daydiff(col1: Union[Column, str], col2: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L4240-L4257)

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
语言: 中文