Hi I have to execute a sum of hours, to do so I use the code c # below: first convert hourtot into timespan then I execute the total sum, at the end the total I get 08:30 which is impossible, how can I solve this? and what is it due to?
C# Code:
/*
hourtot values:
08:30
10:00
09:00
08:30
10:00
10:30*/
TimeSpan tot= TimeSpan.Zero;
foreach (DataRow dr in dt.Rows)
{
String hourtot= r.CaricaOreGiornaliere(dr["date"].ToString());
if(hourtot.Equals("00:00") == false)
{
TimeSpan hourcant= TimeSpan.Parse(hourtot.ToString());
tot= tot+ hourcant;
}
}
labelris.text = "" + tot.ToString(@"hh\:mm"); //this print 08:30