0

I have an input in an asp.net mvc project, and the page receives values ​​through a model, however the value is not showing on the page. When I click F12 and inspect the datetime-local element, the value is there, but not shown. enter image description here

The configure parameters datetime.

[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd'T'HH:mm:ss}")] public DateTime DataPublicacao { get; set; } [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd'T'HH:mm:ss}")] public DateTime DataUltimaAlteracao { get; set; }

Div Dates

<div class="grid-duas-colunas">
                <div class="form-group div-autor-1 col-4">
                    <label asp-for="DataPublicacao" class="control-label"></label>
                    <input asp-for="DataPublicacao" class="form-control" value="@Model.DataPublicacao"/>
                    <span asp-validation-for="DataPublicacao" class="text-danger"></span>
                </div>
                <div class="form-group div-autor-2 col-4">
                    <label asp-for="DataUltimaAlteracao" class="control-label"></label>
                    <input asp-for="DataUltimaAlteracao" class="form-control" value="@Model.DataUltimaAlteracao"/>
                    <span asp-validation-for="DataUltimaAlteracao" class="text-danger"></span>
                </div>
            </div>

Apparently, this formatting is not working correctly. What am I doing wrong?

Leonardo Silva
  • 341
  • 5
  • 17
  • Does this answer your question? [Display DateTime value in dd/mm/yyyy format in Asp.NET MVC](https://stackoverflow.com/questions/18288675/display-datetime-value-in-dd-mm-yyyy-format-in-asp-net-mvc) – Irem Oct 08 '22 at 13:09
  • The solution that worked here was this: – Leonardo Silva Oct 08 '22 at 14:09

0 Answers0