I have the following line of code in my c# MVC2 Project:
string.Format(@"{0\:HH\:mm}", new TimeSpan(0))
This line is resulting in the following exception:
System.FormatException: Input string was not in a correct format.
Can anybody tell me why? I’m using C#, asp.net, mvc2, and .net framework 4
Two problems. Firstly you should not be escaping the first
:. This is necessary as a separator and should not be escaped.The second is that
HHshould behh.This runs without errors: