Generally, do you store your dateTime values as strings or Dates in your model?
Generally, do you store your dateTime values as strings or Dates in your model?
Hi, fritterhat-9706. What value do you want to save in the model class? If you just want to save the date, month and etc, it's better to use the string type. If you want to get the more details about the 'date', you could use the DateTime instead.
public class TestModel
{
public string StartDate { get; set; }
public string EndDate { get; set; }
public DateTime theDate => DateTime.Parse(EndDate);
}
7 people are following this question.