Calendar.AddSeconds Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Returns a DateTime that is the specified number of seconds away from the specified DateTime.
Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Overridable Function AddSeconds ( _ time As DateTime, _ seconds As Integer _ ) As DateTime
Parameters
- time
- Type: System.DateTime
The DateTime to which to add seconds.
- seconds
- Type: System.Int32
The number of seconds to add.
Return Value
Type: System.DateTimeThe DateTime that results from adding the specified number of seconds to the specified DateTime.
| Exception | Condition |
|---|---|
| ArgumentException | The resulting DateTime is outside the supported range of this calendar. |
| ArgumentOutOfRangeException | seconds is outside the supported range of the DateTime return value. |
The seconds value is added to the specified DateTime. If seconds is negative, the resulting DateTime is earlier than the specified DateTime.
The day part of the resulting DateTime is affected if the resulting time is outside the day of the specified DateTime. The month part of the resulting DateTime is affected if the resulting day is outside the month of the specified DateTime. The year part of the resulting DateTime is affected if the resulting month is outside the year of the specified DateTime. The era part of the resulting DateTime is affected if the resulting year is outside the era of the specified DateTime.