I am trying to format the date time attribute in the MVC 4 class as follows:
[Required] [DataType(DataType.Date)] [DisplayFormat(ApplyFormatInEditMode = true,DataFormatString = "{0:dd/MM/yyyy}")] public DateTime DateOfBirth { get; set; }
but the DateOfBirth attribute does not work; the attribute accepts the date format one month before the day (EX: accept 1/27/1990 and not accept 27/1/1990)
I am looking for answers and trying a lot of solutions, but it doesn’t work as
enter the link here
using html helper:
@ Html.TextBoxFor (Model => Model.DateOfBirth) I thank any help thanks
@Html.TextBoxFor() , [DataType(DataType.Date)] ApplyFormatInEditMode = true [DisplayFormat] . @Html.EditorFor() , "yyyy-MM-dd", .
@Html.TextBoxFor()
[DataType(DataType.Date)]
ApplyFormatInEditMode = true
[DisplayFormat]
@Html.EditorFor()
"yyyy-MM-dd"
,
@Html.TextBoxFor(Model => Model.DateOfBirth, "{0:dd/MM/yyyy}")
, "27/1/1990" (27 1990 .), "MM/dd/yyyy", . .
"27/1/1990"
"MM/dd/yyyy"
[[DisplayFormat] . , . , , DateTime. DateTime, , , [[DisplayFormat]
[[DisplayFormat]
, , , , "/", , "/", .
, , - , ,