How to delete zeros after datetime via EntityFramework? when i add record to database it displays it with zeros at the end in my datebase
I specified DisplayFormat but when adding migration my Up method is empty
[Column("Birth date")]
[DisplayFormat(DataFormatString = "{yyyy/MM/dd}")]
public DateTime BirthDate { get; set; }
CodePudding user response:
Use the following
[Column(TypeName="Date")]
[Column("Birth date")]
public DateTime BirthDate { get; set; }
Please read more here https://learn.microsoft.com/en-us/ef/core/modeling/entity-properties?tabs=data-annotations,without-nrt