DateTime.AddDays VS Calendar.AddDaysAddDays、DateTime、Calendar、VS

由网友(枉心)分享简介:之间的 DateTime.AddDays 的有什么区别和 Calendar.AddDays 的?为datetime型日历独立?What is the difference between DateTime.AddDays and Calendar.AddDays?Is DateTime type calendar...

之间的 DateTime.AddDays 的有什么区别和 Calendar.AddDays 的? 为datetime型日历独立?

What is the difference between DateTime.AddDays and Calendar.AddDays? Is DateTime type calendar independent?

推荐答案

DateTime.AddDays只是转换天内蜱和蜱添加的日期时间超过此数目。 Calendar.AddDays的默认实现不完全一样的。然而,由于它是一个虚拟方法,可以在特定的日历在一个更复杂的方式,例如,实施像这里: HTTP:/ /$c$cblog.jonskeet.uk/2010/12/01/the-joys-of-date-time-arithmetic/

DateTime.AddDays just converts days to ticks and adds this number of ticks to the date time. The default implementation of Calendar.AddDays does exactly the same. However, since it is a virtual method it can be implemented in specific calendar in a more complicated way, e.g. something like here: http://codeblog.jonskeet.uk/2010/12/01/the-joys-of-date-time-arithmetic/

阅读全文

相关推荐

最新文章