C# DateTimeOffset AddDays
Description
DateTimeOffset AddDays
adds a specified number of whole
and fractional days to the current DateTimeOffset object.
Syntax
DateTimeOffset.AddDays
has the following syntax.
public DateTimeOffset AddDays(
double days
)
Parameters
DateTimeOffset.AddDays
has the following parameters.
days
- A number of whole and fractional days. The number can be negative or positive.
Returns
DateTimeOffset.AddDays
method returns An object whose value is the sum of the date and time represented by the current
DateTimeOffset object and the number of days represented by days.
Example
The following example uses the AddDays method.
using System;/* w w w . j av a2 s .c om*/
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset workDay = new DateTimeOffset(2014, 3, 1, 9, 0, 0,
DateTimeOffset.Now.Offset);
workDay = workDay.AddDays(1);
Console.WriteLine(" {0:dddd}, {0:MMMM}{0: d}", workDay);
}
}
The code above generates the following result.