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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 time difference

Author  Topic 

pnasz
Posting Yak Master

101 Posts

Posted - 2012-04-03 : 09:05:08
[timein] [schtimein] [late]

8:00 8:51 00:51

8:00 9:50 01:50


Timein and schtimein is datetime format field

if schtimein is greater then timein then only i want the difference in hh:mm format

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-03 : 09:08:02
use DATEDIFF() to find the time difference


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pnasz
Posting Yak Master

101 Posts

Posted - 2012-04-03 : 09:18:59
i want to use it with if condition

if schtime is greater then only i want the difference
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-03 : 09:26:23
[code]
case
when schtime > timein
then ...
else ...
end
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -