I am using ASP.NET Core (.net framework 5.0, Visual studio 2019) & want to set date format as yyyy-mm-dd.
here are my current code
In Model =>
[DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:yyyy-mm-dd}", ApplyFormatInEditMode = true)]
public DateTime? DOB { get; set; }
(also tried with ApplyFormatInEditMode = false)
In view =>
@Html.EditorFor(x => x.DOB)
tried both ways but still getting the mm/dd/yyyy format.
What is wrong with the codes & what I can do ?