I am working on a program that requires the date of an event to get returned.
I am looking for a Date, not a DateTime.
Date
DateTime
Is there a datatype that returns just the date?
No there isn't. DateTime represents some point in time that is composed of a date and a time. However, you can retrieve the date part via the Date property (which is another DateTime with the time set to 00:00:00).
00:00:00
And you can retrieve individual date properties via Day, Month and Year.
Day
Month
Year
UPDATE: In .NET 6 the types DateOnly and TimeOnly are introduced that represent just a date or just a time.
DateOnly
TimeOnly
1.4m articles
1.4m replys
5 comments
56.9k users