Below is my user interface:
I want to calculate total time of class in ASP.net:
I have tried but not working properly and give error:
Incorrect syntax near ')'.
string[] Start = StartTime.Text.Split(':');
string[] End = EndTime.Text.Split(':');
Starthours = int.Parse(Start[0]);
StartMinuts = int.Parse(Start[1]);
Endhours = int.Parse(End[0]);
EndMinuts = int.Parse(End[1]);
for (int i = Starthours; i != Endhours; i++)
{
hours++;
}
for (int i = StartMinuts; i != EndMinuts; i++)
{
if (minuts > 60)
{
hours++;
}
else
{
hours--;
}
}
total = hours.ToString() + ":" + minuts.ToString();