I would like to set a date time picker for my users that they can choose date and time with a picker. But I can only have a date picker without hours.
Here's my model (date property) :
[Column("DATE_EVENEMENT")] [Display(Name = "Date: ")] // Pour afficher uniquement la date sans l'heure [DataType(DataType.Date)] public DateTime DateEvenement { get; set; } Here's my page :
<div class="form-group"> @Html.LabelFor(model => model.DateEvenement, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @Html.EditorFor(model => model.DateEvenement) @Html.ValidationMessageFor(model => model.DateEvenement) </div> </div> My controller is scaffolded so I don't copy it
[DataType(DataType.Date)]means you generate<input type="date" ../>which allow you to select a date only. You could manually add thetype=datetime-localto allow adding time but both of these are only supported in Chrome so suggest you consider a jquery plugin instead