Indicate format for TimeSpan parse
using System; public class Example { public static void Main() { string value = "8"; TimeSpan interval; if (TimeSpan.TryParseExact(value, "%h", null, out interval)) Console.WriteLine(interval.ToString("c")); else Console.WriteLine("Unable to convert '{0}' to a time interval", value); } }