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
 Calculate the Difference time between two times

Author  Topic 

archana23
Yak Posting Veteran

89 Posts

Posted - 2013-10-09 : 16:09:39
Hi,

Right now i am using this expression to get the time difference between two times.

{%Z.elapsed.time(@AK.VD.depart.date,@AK.VD.depart.time,@AK.VD.depart.date,@DV.VD.arrival.time,"hh.hh")*60} as [LOS (min)]

When Arrival time and depart time both are on same day above expression working to get the diference .

But if arrival date 2013-09-20 00:00:00.000 and arrival time 0800
and depart date 2013-09-21 00:00:00.000 and depart time 0050
when i calculate the time difference(using above expression) between these two i am getting -429.60 which is wrong. i have to get around 990.

How can i overcome this problem.

Can any one help me on this ?

Thank you so much

Archana

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-10-09 : 16:36:37
{%Z.elapsed.time(@AK.VD.depart.date,@AK.VD.depart.time,@AK.VD.depart.date,@DV.VD.arrival.time,"hh.hh")*60} as [LOS (min)]

The expression you are using doesn't look familiar syntax for SQL Server. If you are using another RDBMS system, you would get better and faster answers at a forum specific to that system. This forum is a Microsoft SQL Server forum.
Go to Top of Page
   

- Advertisement -