Razor - INPUTタグで日付を編集するViewでフォーマットを指定する@Html.TextBoxFor(m => m.Date, "{0:dd/MM/yyyy}", new { @class = "width-xx" }) 参考http://stackoverflow.com/questions/17602594/mvc-4-editorfor-textboxfor-and-date-field ViewModelでDisplayFormatアトリビュートを使うViewModel[Display(Name = "When was that document issued ?")] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")] public DateTime? LiquorLicenceDocumentIssueDate { get; set; } View@Html.EditorFor(m => m.LiquorLicenceDocumentIssueDate) 参考http://stackoverflow.com/questions/4679352/converting-datetime-format-using-razor/8362126#8362126 参考 |
|