Mega Code Archive
Converts string to TimeSpan
using System;
class MainClass
{
static void Main( )
{
string[] values = { "100000006", "12.12:12:12.12345678" };
foreach (string value in values)
{
try {
TimeSpan interval = TimeSpan.Parse(value);
Console.WriteLine("{0} --> {1}", value, interval);
}
catch (FormatException) {
Console.WriteLine("{0}: Bad Format", value);
}
catch (OverflowException) {
Console.WriteLine("{0}: Overflow", value);
}
}
}
}