About 66 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 - DateDiff to output hours and minutes - Stack Overflow

    Jan 21, 2014 · my code gives TOTAL HOURS in hours, but i am trying to output something like TotalHours 8:36 where 8 represents hour part and 36 represents minutes part mean totalHours a …

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

    DATEDIFF(MONTH, 0, '2-14-2015') --returns month. 0 is for 1/1/1900, and getdate is the current date --(i used a set date bc dates will change as this post gets older). result: 1381 In my workings, I used …

  4. 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

  5. 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 …

  6. sql server - Convert a DATEDIFF result to a string, to concatenate ...

    Dec 30, 2013 · 0 I have a DATEDIFF result (in minutes) that i have divided by 1440 to count as days, I wish to add 'Hours' to the end of it but cant figure out how to turn the result into a string first.

  7. get DATEDIFF excluding weekends using sql server

    Using DATEDIFF(WK, ...) will give us the number of weeks between the 2 dates. SQL Server evaluates this as a difference between week numbers rather than based on the number of days.

  8. sql - Include Start Date and the End Date in DateDiff function - Stack ...

    Start Date End Date Tot#Days 08-04-2014 08-04-2014 1 08-04-2014 08-05-2014 2 08-04-2014 08-07-2014 4 I tried using the DATEDIFF function however I get a 0 for the first example, 1 for second …

  9. 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.

  10. sql - Datediff between 2 columns in same table - Stack Overflow

    Datediff between 2 columns in same table Asked 12 years, 4 months ago Modified 3 years, 6 months ago Viewed 48k times