หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Applies to:
Databricks SQL preview
Databricks Runtime 11.3 LTS and above
Returns the number of days from startDate to endDate.
Syntax
datediff(endDate, startDate)
Arguments
endDate: ADATEexpression.startDate: ADATEexpression.
Returns
An INTEGER.
If endDate is before startDate the result is negative.
To measure the difference between two dates in units other than days use datediff (timestamp) function.
Examples
> SELECT datediff('2009-07-31', '2009-07-30');
1
> SELECT datediff('2009-07-30', '2009-07-31');
-1