开发者

Date instead of DateTime?

开发者 https://www.devze.com 2023-02-24 11:21 出处:网络
Fr开发者_如何学编程om 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?In VB.NET Date is an alias to System.DateTime, s

Fr开发者_如何学编程om 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?


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消