Date vs DateTime

MrM picture MrM · Apr 28, 2009 · Viewed 215.6k times · Source

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.

Is there a datatype that returns just the date?

Answer

Ronald Wildenberg picture Ronald Wildenberg · Apr 28, 2009

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).

And you can retrieve individual date properties via Day, Month and Year.