Calculate Total Hour and Minute in SQL
SELECT ((DATEDIFF(minute, ‘2013-06-30 08:30:00.0000000’, ‘2013-06-30 10:45:00.0000000’))/60) AS TotalHour,
((DATEDIFF(minute, ‘2013-06-30 08:30:00.0000000’, ‘2013-07-30 10:45:00.0000000’))%60) AS TotalMinute
The result of the above query is:
TotalHour TotalMinute
2 15
Comments