Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Calendar.AddMilliseconds Method

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

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
abstract AddMilliseconds : 
        time:DateTime * 
        milliseconds:float -> DateTime 
override AddMilliseconds : 
        time:DateTime * 
        milliseconds:float -> DateTime 

Parameters

time
Type: System.DateTime
The DateTime to add milliseconds to.
milliseconds
Type: System.Double
The number of milliseconds to add.

Return Value

Type: System.DateTime
The DateTime that results from adding the specified number of milliseconds to the specified DateTime.
ExceptionCondition
ArgumentException

The resulting DateTime is outside the supported range of this calendar.

ArgumentOutOfRangeException

milliseconds is outside the supported range of the DateTime return value.

The milliseconds value is rounded to the nearest integer before it is added to the specified DateTime. If milliseconds 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 Kind property of the returned DateTime value always equals DateTimeKind.Unspecified. You can preserve the Kind property of the time parameter by calling the DateTime.SpecifyKind method, as the following example shows.

No code example is currently available or this language may not be supported.

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

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.