Adds a specified time interval to a DateTimeOffset object.
- timeSpan
- A TimeSpan object that represents a positive or a negative time interval.
An object whose value is the sum of the date and time represented by the current DateTimeOffset object and the time interval represented by timeSpan.
You can use the DateTimeOffset.Add(TimeSpan) method to add more than one kind of time interval (days, hours, minutes, seconds, or milliseconds) in a single operation. This method's behavior is identical to the addition operator. The DateTimeOffset structure also supports specialized addition methods (such as DateTimeOffset.AddDays(double), DateTimeOffset.AddHours(double), and DateTimeOffset.AddMinutes(double)) for each time interval.
This method returns a new DateTimeOffset object. It does not modify the value of the current object by adding timeSpan to its date and time.
The DateTimeOffset.Add(TimeSpan) method does not affect the value of the current DateTimeOffset object's DateTimeOffset.Offset property.
Because a DateTimeOffset object does not represent the date and time in a specific time zone, the DateTimeOffset.Add(TimeSpan) method does not consider a particular time zone's adjustment rules when it performs date and time arithmetic.
If the timeSpan parameter is null, this method returns the value of the original DateTimeOffset object unchanged.