Tags

,


Time between two Dates

To Get Times between two dates in H:m:s just see the following

Select
dt_callStartTime –Call Starting Time
,dt_callEndTime –Call Ending Time
,CONVERT(VARCHAR –3. Conert in Varchar
,dateadd(ss, –2. Add Seconds in dates to get h:m:s
(datediff –1. Get Seconds from two dates
(
SS –for Seconds
,dt_callStartTime –Starting Date
,dt_callEndTime –Endding Date
)
),’01-01-2009 00:00:00′ –Dummy Date to Add Seconds
),108 –Dormat
)as [Duration] –Label
from
tx_CallHistory
Where
dt_callEndTime is not null

Result will be::
dt_callStartTime dt_callEndTime Duration
2009-07-24 02:56:08.000 2009-07-24 02:56:31.643 00:00:23
2009-07-24 03:23:24.453 2009-07-24 03:35:28.687 00:12:04
2009-07-24 03:35:48.890 2009-07-24 03:36:27.317 00:00:39

Enjoy!

Advertisements