This topic has not yet been rated - Rate this topic

DateTime.Addition Operator

April 12, 2014

Adds a specified time interval to a specified date and time, yielding a new date and time.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)
Public Shared Operator + ( _
	d As DateTime, _
	t As TimeSpan _
) As DateTime


Type: System.DateTime
The first object to add.
Type: System.TimeSpan
The second object to add.

Return Value

Type: System.DateTime
An object that is the sum of the values of d and t.

The resulting DateTime is earlier than DateTime.MinValue or later than DateTime.MaxValue.

The following example demonstrates the addition operator.

Dim dTime As Date = #8/5/1980#

' tSpan is 17 days, 4 hours, 2 minutes and 1 second.
Dim tSpan As New TimeSpan(17, 4, 2, 1)

Dim result1, result2 As Date

' result1 and result2 get 8/22/1980 4:02:01 AM.
result1 = Date.op_Addition(dTime, tSpan)

result2 = dTime + tSpan

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.