Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi All,I have two fields in my table.. starttime and endtimehow can i get the difference btween these two times ?Is this possible?I am using sqlserver 2000Can anyone please help me in this?Thanks
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2007-02-11 : 21:37:33
yes. This is possible. You can use datediff() function
select [diff in seconds] = datediff(second, starttime, endtime), [diff in minutes] = datediff(minute, starttime, endtime), [diff in hours] = datediff(hour, starttime, endtime)