Data Format (Dataannotations) does not work - Asp.net Core

Asked

Viewed 62 times

0

I’m having problems with displaying a datetime format. I get the "03/12/1980 12:34:09", but only the input mask appears. How to make the date appear along with the time?

Thank you :)

inserir a descrição da imagem aqui

[DisplayName("Data/Hora de Inclusao")]
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd HH:mm:ss}", ApplyFormatInEditMode = true)]
[DataType(DataType.DateTime, ErrorMessage = "Data em formato inválido")]
public DateTime DataHoraInclusao { get; set; }
  • strip that DisplayFormat? and tell me

  • I removed, only that the date is displayed like this: 12/03/1980 12:34:09,864

  • 1

    It is the format in Displayformat that you put wrong you’re looking at it the way it is there day, month, year hours minutes and seconds dd/MM/yyyy HH:mm:ss test?

  • It worked. Thank you :)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.