I want to exclude a part timein the DateTime text box, but I cannot make it work the way I want.
This is how I set the field:
@Html.TextBoxFor(m => m.DateFrom, "{0:dd/MM/yyyy}", new { @class = "datefrom" })
@Html.TextBoxFor(m => m.DateTo, "{0:dd/MM/yyyy}", new { @class = "dateto" })
JQuery script:
$(function () {
$(".datefrom").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
dateFormat: "dd/mm/yy",
onClose: function (selectedDate) {
$("#to").datepicker("option", "minDate", selectedDate);
}
});
$(".dateto").datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
dateFormat: "dd/mm/yy",
onClose: function (selectedDate) {
$("#from").datepicker("option", "maxDate", selectedDate);
}
});
});
Now I have the following problems:
time always displayed in the field:

- Invalid
date format: my format is dd / MM / yyyy, a date November 8th 2014, but now the date picker “thinks” that it is August 10th 2014. Therefore, when I select an arbitrary date from a datepicker in the format dd/MM/yyyy, asp.net will process it in the formatMM/dd/yyyy
What I tried:
I tried to use DataAnnotations: [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]not working
I tried to remove the jQuery script, did not work
P/s: datetime time , datepicker time , , :
