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 2000 Forums
 SQL Server Development (2000)
 dividing time value

Author  Topic 

zubair
Yak Posting Veteran

67 Posts

Posted - 2003-07-16 : 06:41:54
Hi,

i've using the following sql to calculate the difference between two dates and then displaying the it in a time format like follows
hh:mm:ss

select convert(varchar(10),dateadd(ss,abs(datediff(ss, '2003-07-08 15:03:16', '2003-07-08 10:31:41')),0),8)

whci gives me a result as follows
04:31:35

however what i want to do next is to divide this value by another number say 6 for example. How do i do this?

Any help greatly appreciated. Thanks


robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-07-16 : 06:59:55
Divide the seconds by 6, then convert it:

select convert(varchar(10),dateadd(ss,abs(datediff(ss, '2003-07-08 15:03:16', '2003-07-08 10:31:41'))/6,0),8)

Go to Top of Page

zubair
Yak Posting Veteran

67 Posts

Posted - 2003-07-16 : 08:01:17
Thanks worked a treat, and it was so simple :)

Go to Top of Page
   

- Advertisement -