DateTime类型通过以下函数更改时间。这种改变方式不改变变量本身。
This method does not change the value of this DateTime. Instead, a new DateTime is returned whose value is the result of this operation
Name Description
Add Adds the value of the specified TimeSpan to the value of
this instance.
AddDays Adds the specified number of days to the value of this instance.
AddHours Adds the specified number of hours to the value of this instance.
AddMilliseconds Adds the specified number of milliseconds to the value of this
instance.
AddMinutes Adds the specified number of minutes to the value of this
instance.
AddMonths Adds the specified number of months to the value of this instance.
AddSeconds Adds the specified number of seconds to the value of this
instance.
AddTicks Adds the specified number of ticks to the value of this instance.
AddYears Adds the specified number of years to the value of this instance.
本文介绍如何使用DateTime类型的Add系列方法来调整日期时间。这些方法包括添加天数、小时、分钟等,并且不会直接修改原始DateTime实例,而是返回一个新的实例。

2274

被折叠的 条评论
为什么被折叠?



