I need my date input to be dd/MM/yyyy
, but when I use this code:
$('#DateTime').datepicker({ dateFormat: 'dd/MM/yyyy' });
It shows the date like this: 28/December/20162016
.
Any idea?
Update:
It works now with this format dd/mm/yy
. But the problem is that, when I pass a date like 17/12/2016
the server says that: (it gets null)
The value '17/12/2016' is not valid for DateTime.
PS: I'm using ASP.NET MVC and my property is:
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? DateTime { get; set; }