Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Returns the number of days from start to end.
For the corresponding Databricks SQL function, see datediff function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.datediff(end=<end>, start=<start>)
Parameters
| Parameter | Type | Description |
|---|---|---|
end |
pyspark.sql.Column or str |
to date column to work on. |
start |
pyspark.sql.Column or str |
from date column to work on. |
Returns
pyspark.sql.Column: difference in days between two dates.
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('2015-04-08','2015-05-10')], ['d1', 'd2'])
df.select('*', dbf.datediff('d1', 'd2')).show()
df.select('*', dbf.datediff(df.d2, df.d1)).show()