datetime class : AddDays(int) method
Description
Gets a new datetime instance which is obtained by adding the number of days to the invoker instance.
Syntax
datetimeInstance.AddDays(int numberOfDays)
Arguments
Class | Name | Description |
int | numberOfDays | Number of days |
Return value
Class | Description |
datetime | New datetime type instance which is obtained by adding the argument. |
Sample code
1: | datetime dt = new datetime(2016, 3, 4, 4, 13, 0); |
2: | datetime addDay1 = dt.AddDays(5); // 2016/3/9 4:13:00 |
3: | datetime addDay2 = dt.AddDays(-5); // 2016/2/28 4:13:00 |
Notes
It's a wrapper of the System.DateTime.AddDays(Double) method.