Reputation: 2058
I've developed a web program in visual studio 2008 and converted it to 2010. In a Datagrid
I have a data column with TimeSpan
value. In 2008 I gave it string format 0:hh:mm
and after the conversion I was getting a FormatException: Input string was not in a correct format
. I corrected the string formattig to 0:hh\:mm
as I found in Microsoft documentation for .NET 4.0. When I run the application from visual studio it works but when I copy it and run from the IIS it's still giving that error. What could be the problem?
Upvotes: 2
Views: 934
Reputation: 61912
In .NET version 3.5 and earlier, the TimeSpan
struct wasn't IFormattable
. Using a format string as in string.Format("Ipsum {0:HERE} ipsum", yourTimeSpan)
would just ignore the format.
Since .NET 4.0, the TimeSpan
is IFormattable
. There's a new overload of ToString
because of that, and it is called instead.
Upvotes: 4