DateTimeOffset.AddMilliseconds(Double) 方法

定义

返回一个新的 DateTimeOffset 对象,它将指定的毫秒数加到此实例的值上。Returns a new DateTimeOffset object that adds a specified number of milliseconds to the value of this instance.

public:
 DateTimeOffset AddMilliseconds(double milliseconds);
public DateTimeOffset AddMilliseconds (double milliseconds);
member this.AddMilliseconds : double -> DateTimeOffset
Public Function AddMilliseconds (milliseconds As Double) As DateTimeOffset

参数

milliseconds
Double

由整数和小数部分组成的毫秒数。A number of whole and fractional milliseconds. 此数值可以是负数也可以是正数。The number can be negative or positive.

返回

一个对象,其值为当前 DateTimeOffset 对象表示的时间和日期与 milliseconds 对象表示的整毫秒数之和。An object whose value is the sum of the date and time represented by the current DateTimeOffset object and the number of whole milliseconds represented by milliseconds.

例外

生成的 DateTimeOffset 值小于 MinValueThe resulting DateTimeOffset value is less than MinValue.

-或--or- 生成的 DateTimeOffset 值大于 MaxValueThe resulting DateTimeOffset value is greater than MaxValue.

注解

milliseconds 参数的小数部分是毫秒的小数部分。The fractional part of the milliseconds parameter is the fractional part of a millisecond. 例如,4.5 等效于4毫秒,5000计时周期,其中一毫秒等于10000刻度。For example, 4.5 is equivalent to 4 milliseconds and 5000 ticks, where one millisecond equals 10,000 ticks. milliseconds 舍入为最接近的毫秒;向上或向后舍入的所有值。However, milliseconds is rounded to the nearest millisecond; all values of .5 or greater are rounded up.

备注

此方法返回新的 DateTimeOffset 对象。This method returns a new DateTimeOffset object. 它不会通过将 milliseconds 添加到其日期和时间来修改当前对象的值。It does not modify the value of the current object by adding milliseconds to its date and time.

由于 DateTimeOffset 对象不表示特定时区中的日期和时间,因此 AddMilliseconds 方法在执行日期和时间算术时不会考虑特定时区的调整规则。Because a DateTimeOffset object does not represent the date and time in a specific time zone, the AddMilliseconds method does not consider a particular time zone's adjustment rules when it performs date and time arithmetic.

适用于

另请参阅