It might be too late to answer this in 2019. but I tried all the answers and none worked for me. So I solved it simply this way:
@Html.EditorFor(m => m.SellDateForInstallment, "{0:dd/MM/yyyy}",
new {htmlAttributes = new { @class = "form-control", @type = "date" } })
EditorFor
is what worked for me.
Note that SellDateForInstallment
is a Nullable
datetime object.
public DateTime? SellDateForInstallment { get; set; } // Model property