Export (0) Print
Expand All

Calendar.AddSeconds Method

Returns a DateTime that is the specified number of seconds away from the specified DateTime.

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

public virtual DateTime AddSeconds(
	DateTime time,
	int seconds
)

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.DateTime
The DateTime that results from adding the specified number of seconds to the specified DateTime.

ExceptionCondition
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.

The following code example demonstrates the members of the Calendar class.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft