Date instead of DateTime?

vb.net

vb.net Problem Overview


From what I can tell Date and DateTime have the same functionality. Is there a reason why I would want to use one instead of the other?

vb.net Solutions


Solution 1 - vb.net

In VB.NET Date is an alias to System.DateTime, so yes, they're the same thing. You can see all the aliases in this chart on MSDN.

Solution 2 - vb.net

C# has no Date type, but DateTimes do have a Date property which returns a DateTime with all of the time-related fields cleared out.

Specifically it returns:

> A new object with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00).

VB.NET does have a Date type but it is equivalent to a CLR DateTime

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpokeView Question on Stackoverflow
Solution 1 - vb.netR. Martinho FernandesView Answer on Stackoverflow
Solution 2 - vb.netDaniel DiPaoloView Answer on Stackoverflow