Hi , How to Add Time Values.
-
Hi , I Have Some Time(hh,mm,ss) Values Ex. 09:00:00 , 09:25:00 , 10:30:00 Now i Have to Add these All Value And find Total No. Of Hours & Minutes & Seconds . I m using Asp.Net2.0 & Sql 2000 . How Can i Do This . Thanx.
-
Hi , I Have Some Time(hh,mm,ss) Values Ex. 09:00:00 , 09:25:00 , 10:30:00 Now i Have to Add these All Value And find Total No. Of Hours & Minutes & Seconds . I m using Asp.Net2.0 & Sql 2000 . How Can i Do This . Thanx.
-
Hi , I Have Some Time(hh,mm,ss) Values Ex. 09:00:00 , 09:25:00 , 10:30:00 Now i Have to Add these All Value And find Total No. Of Hours & Minutes & Seconds . I m using Asp.Net2.0 & Sql 2000 . How Can i Do This . Thanx.
Turn those values into TimeSpan values, representing the time span from midnight to the time given. Then you can easily add them. Use the Hours, Minutes and Seconds properties to get the result. Or add the TimeSpan to a DateTime value to make it a DateTime, which you can easily format into a string. Example:
TimeSpan t1 = new TimeSpan(9, 0, 0);
TimeSpan t2 = new TimeSpan(9, 25, 0);
TimeSpan total = t1 + t2;
string result = DateTime.Today.Add(total).ToString("HH:mm:ss"));Despite everything, the person most likely to be fooling you next is yourself.