In ASP.NET MVC RC3 with Razor - @String.Format("{0:hh:mm:ss}", timespan) errors - bug?
The following errors with a FormatException:
<td class="numeric">@String.Format("{0:hh:mm:ss}", testrun.ExecutionTime)</td>
Where ExecutionTime
is a TimeSpan. This format string is valid. Is this a bug or am I missing s开发者_运维问答omething obvious (given the late hour - the latter is probably it).
Try escaping the :
String.Format("{0:hh\\:mm\\:ss}", testrun.ExecutionTime)
Aren't you looking for the @testRun.ExecutionTime.ToString("format here")
method?
Format strings for timespan: http://msdn.microsoft.com/en-us/library/dd992632.aspx
精彩评论