Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 something obvious (given the late hour - the latter is probably it).

like image 838
Keith Hill Avatar asked Dec 12 '22 17:12

Keith Hill


1 Answers

Try escaping the :

String.Format("{0:hh\\:mm\\:ss}", testrun.ExecutionTime)
like image 61
Darin Dimitrov Avatar answered Mar 02 '23 01:03

Darin Dimitrov