Check for valid Day hour and Minutes (improve code)
<p>I have a string in a format like 22 : 19 : 37 where 22 is Days, 19 is hours and 37 is minutes, this is what I have written to validate Hour and Minutes.</p>

<pre><code>string value = "22 : 19 : 37";            

string[] time = (value as string).Split(new char[] { ':' });

if (time.Length != 3)
{
     Console.WriteLine("Error");
     return;
}

int DD = System.Convert.ToInt32(time[0]);
int HH = System.Convert.ToInt32(time[1]);
int MM = System.Convert.ToInt32(time[2]);

// Hour should be less than 24
if (HH &gt; 23)
{
    Console.WriteLine("Invalid Hour Error");
    return;
}

// Minutes should be less than 60
if (MM &gt; 59)
{
     Console.WriteLine("Invalid Minute Error");
     return;
}
</code></pre>

<p>I don't like the code, is there anyway to improve this.</p>