0
I have two dates 1)10/16/2013 17:00:20 2)13/16/2013 17:20:60 ... I need difference between these two dates as 72:20:40
I have two dates 1)10/16/2013 17:00:20 2)13/16/2013 17:20:60 ... I need difference between these two dates as 72:20:40 I need difference between two dates as HH:MM:SS
11 odpowiedzi
+ 2
vijay
It seems your second date doesn't make a valid date neither by MDY or DMY format. Also, the seconds portion of time ranges from 00-59, so the time is invalid too.
13/16/2013 17:20:60
Just giving you a notification about it, whichever path you choose, it will be hard to expect valid result given one of the dates were invalid : )
+ 1
Ace yeah i dont use time stuff or even sql im a c++ guy
+ 1
Thanks you for your response...but I need the difference as in the format ...only HH:MM:SS
0
maybe you can set each day/month/year as a variable and then subtract them
6 july 2019 - 3 january 2017
6 - 3 = 3
7 - 1 = 6
2019 - 2017 = 2
3 days, 6 months, 2 years
0
vijay there probs is a function for that otherwise u can use my way
0
Ace cool, will try
0
Thank You very much Sayan Chandra ,yes true this is what I'm looking for .. select @StartDate = '10/01/2012 08:40:18.000',@EndDate='10/04/2012 09:52:48.000' select convert(varchar(5),DateDiff(s, @startDate, @EndDate)/3600)+':'+convert(varchar(5),DateDiff(s, @startDate, @EndDate)%3600/60)+':'+convert(varchar(5),(DateDiff(s, @startDate, @EndDate)%60)) as [hh:mm:ss]
This query helpful
I'm trying to add one column as TAT by using above logic . I'm not getting the result as expected
0
thank you all for your response