I have a model which has a date, when I run my code, it gives me 29/08/2019 00:00:00
. I want it to be 29/08/2019
In my model, I have tried:
[DataType(DataType.Date)]
public DateTime? Date { get; set; }
and
[DisplayFormat(DataFormatString = "{0:dd MMM yyyy}")]
public DateTime? Date { get; set; }
but both seem to not work, I keep getting 29/08/2019 00:00:00
.
I am open to suggestions using the razor page but I do think it's easier to sort this out in the model.