Custom SQL Server datediff function with same logic as databricks So apparently datediff on Databricks has different behavior compared to SQL Server.