# DateTime.Add(TimeSpan)DateTime.Add(TimeSpan)DateTime.Add(TimeSpan)DateTime.Add(TimeSpan) Method

## 定义

``````public:
DateTime Add(TimeSpan value);``````
``public DateTime Add (TimeSpan value);``
``member this.Add : TimeSpan -> DateTime``
``Public Function Add (value As TimeSpan) As DateTime``

#### 参数

value
TimeSpan TimeSpan TimeSpan TimeSpan

## 示例

``````// Calculate what day of the week is 36 days from this instant.
System::DateTime today = System::DateTime::Now;
System::TimeSpan duration( 36, 0, 0, 0 );
System::DateTime answer = today.Add( duration );
System::Console::WriteLine( " {0:dddd}", answer );
``````
``````// Calculate what day of the week is 36 days from this instant.
System.DateTime today = System.DateTime.Now;
System.TimeSpan duration = new System.TimeSpan(36, 0, 0, 0);
System.DateTime answer = today.Add(duration);
System.Console.WriteLine("{0:dddd}", answer);
``````
``````' Calculate what day of the week is 36 days from this instant.
Dim today As System.DateTime
Dim duration As System.TimeSpan
Dim answer As System.DateTime

today = System.DateTime.Now
duration = New System.TimeSpan(36, 0, 0, 0)
answer = today.Add(duration)

System.Console.WriteLine("{0:dddd}", answer)
``````

## 注解

Add方法会在执行日期算法时考虑闰年和月份中的天数。The Add method takes into account leap years and the number of days in a month when performing date arithmetic.