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

5
  • Possible duplicate of: stackoverflow.com/questions/93472/…. This question should help you fix this issue. Commented Oct 13, 2015 at 14:00
  • I've tried this solution without success... Commented Oct 13, 2015 at 14:16
  • 1
    @levelonehuman That question is about the WinForms control. This question is web. Commented Oct 13, 2015 at 14:18
  • if you set the datatype to just date, doesnt that mean you dont want the time? Commented Oct 13, 2015 at 14:29
  • [DataType(DataType.Date)] means you generate <input type="date" ../> 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 Commented Oct 13, 2015 at 22:31

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.