Date instead of DateTime?

后端 未结 2 818
青春惊慌失措
青春惊慌失措 2020-12-10 10:19

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?

相关标签:
2条回答
  • 2020-12-10 10:52

    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.

    0 讨论(0)
  • 2020-12-10 10:54

    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

    0 讨论(0)
提交回复
热议问题