How to calculate time durations for Star time and End time Difference durations.
for Example Strar Time 10.00AM and End Time 12.00AM.
Thanks&Regs
Manavalan.A
How to calculate time durations?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 29, 2012, 2:37 AM EST
for C#, Try this.
DateTime time1 = DateTime.ParseExact("23:25:52", "HH:mm:ss", new DateTimeFormatInfo());
DateTime time2 = DateTime.ParseExact("13:15:16", "HH:mm:ss", new DateTimeFormatInfo());
TimeSpan Difftime = time1.Subtract(time2);
for SQL, try..
use DateDiff function but it vary difficult to get in HH:SS format.
SELECT DATEDIFF(hour, '2005-12-31 22:59:59.9999999', '2005-12-31 23:50:00.0000000');
SELECT DATEDIFF(minute, '2005-12-31 22:59:59.9999999', '2005-12-31 23:50:00.0000000');
SELECT DATEDIFF(second, '2005-12-31 22:59:59.9999999', '2005-12-31 23:50:00.0000000');
hope this help