本文介绍了DateTime.AddDays VS Calendar.AddDays的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之间的 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/

这篇关于DateTime.AddDays VS Calendar.AddDays的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:51