datetime class : AddSeconds(int) method
Description
Gets a new datetime instance which is obtained by adding the number of seconds to the invoker instance.
Syntax
datetimeInstance.AddSeconds(int numberOfSeconds)
Arguments
Class | Name | Description |
int | numberOfSeconds | Number of seconds |
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 addSecond1 = dt.AddSeconds(5); // 2016/03/04 4:13:05 |
3: | datetime addSecond2 = dt.AddSeconds(-5); // 2016/03/04 4:12:55 |
Notes
It's a wrapper of the System.DateTime.AddSeconds(Double) method.