Date instead of DateTime?

后端 未结 2 830
青春惊慌失措
青春惊慌失措 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: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

提交回复
热议问题