Hi,
I want to parse the time from a string in c#, something like,
TimeSpan a = new TimeSpan();
string pattern = @"^\d{1}:\d{1}@";
if ( dt.Rows[x][y].ToString() != "" && System.Text.RegularExpressions.Regex.IsMatch(dt.Rows[x][y].ToString(), pattern ) ) {
if ( !TimeSpan.TryParse(dt.Rows[x][y].ToString(),out a ) )
{
MessageBox.Show(b.ToString());
}
}
So, if I have a string with 8:00 or 12:59 is valid. But if I have 13:00 or just a number like 8 an nothing else give to me an error. Any ideas?