Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get hours from subtracting two date time values in SQL Server 2005

I have two date values: 08/6/2009 00:00:00 and 10/6/2009 23:59:59.

How do I get the difference in hours in a query in SQL Server 2005?

like image 976
monkey_boys Avatar asked Aug 06 '09 11:08

monkey_boys


1 Answers

SELECT  DATEDIFF(hour, '2009-08-06 00:00:00', '2009-10-06 23:59:59')

---
 71
like image 79
Quassnoi Avatar answered Nov 15 '22 07:11

Quassnoi