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

24th Aug 2019, 8:32 PM
vijay
vijay - avatar
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 : )
25th Aug 2019, 6:28 AM
Ipang
+ 1
Ace yeah i dont use time stuff or even sql im a c++ guy
24th Aug 2019, 9:16 PM
Cat Sauce
Cat Sauce - avatar
+ 1
Thanks you for your response...but I need the difference as in the format ...only HH:MM:SS
24th Aug 2019, 9:18 PM
vijay
vijay - avatar
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
24th Aug 2019, 9:09 PM
Cat Sauce
Cat Sauce - avatar
0
vijay there probs is a function for that otherwise u can use my way
24th Aug 2019, 9:20 PM
Cat Sauce
Cat Sauce - avatar
0
Ace cool, will try
24th Aug 2019, 9:20 PM
Cat Sauce
Cat Sauce - avatar
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
25th Aug 2019, 6:20 AM
vijay
vijay - avatar
0
thank you all for your response
26th Nov 2019, 4:08 PM
vijay
vijay - avatar