I have a chronometer with this code:
private void cronometro_Tick(object sender, EventArgs e)
{
seg++;
if(seg == 60)
{
min++;
seg = 0;
}
else if (min == 60)
{
hr++;
min = 0;
}
str_crono = hr.ToString().PadLeft(2, '0') + ":" + min.ToString().PadLeft(2, '0') + ":" + seg.ToString().PadLeft(2, '0');
label7.Text = str_crono;
}
After this, I try to break down to convert all the time of the chrono to seconds with this code:
DateTime conversionlabel = System.Convert.ToDateTime(str_crono);
int hh = conversionlabel.Hour;
int mm = conversionlabel.Minute;
int ss = conversionlabel.Second;
The drawback is that when str_crono
equals: 00:60:00 it sends me this error:
The string represents a DateTime not supported in the System.Globalization.GregorianCalendar calendar. **
Any ideas? what am I doing wrong? Thanks !!