About 64 results
Open links in new tab
  1. Difference of two date time in sql server - Stack Overflow

    Jan 22, 2010 · 20 I can mention four important functions of MS SQL Server that can be very useful: 1) The function DATEDIFF () is responsible to calculate differences between two dates, the result could …

  2. sql server 2008 - DATEADD (MONTH, DATEDIFF (MONTH, 0, GETDATE …

    Jul 26, 2012 · The DateDiff function returns how many seconds, months, years - whatever interval you specify between the first date (here 0) and the second date (here the current date).

  3. sql server - Calculate exact date difference in years using SQL - Stack ...

    sql sql-server datediff edited Apr 18, 2014 at 16:47 user330315 asked Apr 17, 2014 at 23:59

  4. sql server - DateDiff () applied to column dates - Stack Overflow

    Aug 14, 2025 · I have this query that works as expected but now how do I adapt it so that it can be used to a column of dates in a table. Currently, the startdate is hard-wired so it is not as useful as possible.

  5. sql - Calculate business hours between two dates - Stack Overflow

    Mar 11, 2011 · It works, because in SQL Server DATEDIFF returns the count of the specified datepart boundaries crossed between the specified startdate and enddate. Each day has 8 business hours.

  6. sql server - Make DATEDIFF () compatible with clock changes - Stack ...

    Apr 2, 2024 · Make DATEDIFF () compatible with clock changes Asked 2 years ago Modified 1 year, 11 months ago Viewed 394 times

  7. SQL Server : Computed Column DATEDIFF Clause - Stack Overflow

    (datediff(day, [Control_OpenDate], getdate())) which gives the days up to date. Everything is working perfect but I want to add like an IF condition to the computed column whenever the column …

  8. SQL Server DATEDIFF round up the YEAR difference. How to round it …

    Feb 8, 2019 · SQL Server DATEDIFF round up the YEAR difference. How to round it down? Asked 7 years, 2 months ago Modified 1 year, 2 months ago Viewed 13k times

  9. sql server - DATEDIFF Rounding - Database Administrators Stack …

    Aug 27, 2024 · Finally, we have DATEDIFF supplied with a datetime and the result of converting the varchar strings to datetime2(3) (with a default style). The execution plan shows the explicit cast to …

  10. SQL Server : DATEDIFF not accurate - Stack Overflow

    Nov 6, 2015 · I'm trying to retrieve the month difference of two dates but it seems like I can't find a way to get the accurate months. Here are the queries I tried so far : SELECT …