Search code examples
c#datetypes

C# Data type for Birthdate


There is no Date type. If I want an object that is only a date with no time, like a birthdate, what type would I use?

I'm sure this question has been asked and answered already, but I'm not finding this exact question, only lots about date and datetime in general.

Thanks!

(Edit: I am not asking how to remove the date, or the time, from a DateTime. I was hoping that there might be a data type that stores ONLY date, and not a date and a time together. The answer, it seems, is No.)


Solution

  • There is no just Date type, use the DateTime data type and only set the date, the time will be all 0s.