0

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

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
Xr4y
  • 29
  • 8
  • Possible duplicate of: http://stackoverflow.com/questions/93472/datetimepicker-pick-both-date-and-time?rq=1. This question should help you fix this issue. – levelonehuman Oct 13 '15 at 14:00
  • I've tried this solution without success... – Xr4y Oct 13 '15 at 14:16
  • 1
    @levelonehuman That question is about the WinForms control. This question is web. – itsme86 Oct 13 '15 at 14:18
  • if you set the datatype to just date, doesnt that mean you dont want the time? – JamieD77 Oct 13 '15 at 14:29
  • `[DataType(DataType.Date)]` means you generate `` which allow you to select a date only. You could manually add the `type=datetime-local` to allow adding time but both of these are only supported in Chrome so suggest you consider a jquery plugin instead –  Oct 13 '15 at 22:31

0 Answers0