In Model:
public DateTime? FromDate{get;set;}
In view:
In Index view it shows the time also
problem is that I do not want to show the time with the date in the Index view .
CodePudding user response:
To set display format for the DateTime
property type use the DisplayFormat
attribute in the model declaration, like below:
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime? FromDate { get; set; }