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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Time difference

Author  Topic 

jogin malathi
Posting Yak Master

117 Posts

Posted - 2007-07-25 : 08:48:54
hi all,
i want the time difference

for that iam taking two columns as in_time and out_time

and my select statement as follows
select datediff(hh,in_time,out_time)
And my data table is as follows

table:

in_time out_time
11:23:56 12:23:53
10:24:56 12:45:60

but i want the output in hh:mm:ss formate


Malathi Rao

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-25 : 08:57:05
please post in appropriate forum. Script Library is for posting workable script for sharing, not for asking question.

{MOD. Please move this}


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

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-25 : 09:08:27
[code]select convert(varchar(10), dateadd(second, datediff(second, in_time, out_time), 0), 108)[/code]


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

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-25 : 09:29:40
at your command sir
topic moved.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-25 : 09:41:28
Thank you Sir Mod of CyberYak


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

Go to Top of Page
   

- Advertisement -