Asp.net mvc 3 以特定格式显示日期不是';行不通

Asp.net mvc 3 以特定格式显示日期不是';行不通,asp.net-mvc-3,data-annotations,Asp.net Mvc 3,Data Annotations,试图在ViewModel中格式化DateTime to Date,但它不起作用 视图模型 [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)] public DateTime? TargetCompletionDate { get; set; } 看法 (已解决)我将其命名为@Html.EditorFor,效果很好。 谢谢 它还显示了在我这边工作的时间字段(2014年3

试图在ViewModel中格式化DateTime to Date,但它不起作用

视图模型

   [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}", ApplyFormatInEditMode = true)]
    public DateTime? TargetCompletionDate { get; set; }
看法

(已解决)我将其命名为@Html.EditorFor,效果很好。 谢谢


它还显示了在我这边工作的时间字段(2014年3月31日12:00:00 AM)。它在显示模式下显示不正确吗?它显示的是默认时间,当我将它改为@Html.editor时,它工作得非常好。非常感谢。
 @Html.TextBoxFor(m => m.TargetCompletionDate, new { style = "width: 100px;" })
@Html.EditorFor(m => m.TargetCompletionDate, new { style = "width: 100px;" })