I have a class in Models folder of an asp.net project which has a field with datatype Datetime. Now I want the date and time parts of this field to be populated through a Create.cshtml page.
The field in Models folder is:
[Display(Name = "Event Date and Time")]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime? EventDate { get; set; }
The Create.cshtml page has this code for inputting EventDate:
<div class="editor-label">
@Html.LabelFor(model => model.EventDate)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.EventDate)
@Html.ValidationMessageFor(model => model.EventDate)
</div>
The input-box which gets displayed on Create page only accepts date. I am thinking that this is because of DataFormatString = "{0:yyyy-MM-dd}" . Can anyone tell me what should I change this to, so that I can input both date and time from that box?