DateTime.AddSeconds Method

Windows Automotive 5.0/5.5
Adds a specified number of seconds to the current DateTime object.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public DateTime AddSeconds (
         double val


A specific number of seconds. Note that the number in the val parameter can be either positive or negative, and it can express partial seconds as well as whole seconds.

Return Value

A new DateTime object having a value that represents the sum of the current DateTime object and the specified number of seconds.

This method does not change the value of the current DateTime object; rather, it returns a new DateTime object.

The fractional part of a second is represented by the fractional part of the val parameter. For example, 4.5 is equivalent to 4 seconds, 500 milliseconds, and 0 ticks. The number in the val parameter is rounded to the nearest tick.

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

Community Additions