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
 Count Time

Author  Topic 

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-24 : 03:08:46
In my table have LoginTime and LogOutTime

i need how long time(hours/Minutes/Seconds) used in User

need query..........

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-24 : 03:23:39
[code]
select time_used_in_hours = datediff(hour, LoginTime, LogoutTime),
time_used_in_minutes = datediff(minute, LoginTime, LogoutTime),
time_used_in_seconds = datediff(second, LoginTime, LogoutTime)
from mytable

or in decimal

select time_used_in_minutes = datediff(second, LoginTime, LogoutTime) / 60.0
from mytable

[/code]


KH

Go to Top of Page

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-24 : 03:29:42
thanks very much
Go to Top of Page
   

- Advertisement -