Formatting MVC model TimeSpan field
问题 I have a MVC page containing a few timepickers. These are stored in a list of objects in the model as nullable TimeSpan . The problem is that I get the timespans printed with seconds into the input fields. Is there some way to format these model properties so that I get the timespans printed in some other way (like 7:00 , instead of 07:00:00 )? Needless to say, my "suggestion" of [DisplayFormat...] didn't work. At least not the way I hoped. The input fields are defined like this: @Html