C# DateTimeOffset AddMilliseconds
Description
DateTimeOffset AddMilliseconds
adds a specified number
of milliseconds to the current DateTimeOffset object.
Syntax
DateTimeOffset.AddMilliseconds
has the following syntax.
public DateTimeOffset AddMilliseconds(
double milliseconds
)
Parameters
DateTimeOffset.AddMilliseconds
has the following parameters.
milliseconds
- A number of whole and fractional milliseconds. The number can be negative or positive.
Returns
DateTimeOffset.AddMilliseconds
method returns 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.
Example
using System;/*from ww w.ja va 2 s.c o m*/
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset startTime = new DateTimeOffset(2014, 8, 6, 0, 0, 0,
DateTimeOffset.Now.Offset);
DateTimeOffset startOfShift = startTime.AddMilliseconds(8);
Console.WriteLine("Shifts for the week of {0:D}", startOfShift);
}
}
The code above generates the following result.