C# DateTimeOffset AddSeconds
Description
DateTimeOffset AddSeconds
adds a specified number of
whole and fractional seconds to the current DateTimeOffset object.
Syntax
DateTimeOffset.AddSeconds
has the following syntax.
public DateTimeOffset AddSeconds(
double seconds
)
Parameters
DateTimeOffset.AddSeconds
has the following parameters.
seconds
- A number of whole and fractional seconds. The number can be negative or positive.
Returns
DateTimeOffset.AddSeconds
method returns An object whose value is the sum of the date and time represented by the current
DateTimeOffset object and the number of seconds represented by seconds.
Example
using System;//from w ww.ja v a 2 s . c om
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset quarterDate = new DateTimeOffset(2014, 1, 1, 0, 0, 0,
DateTimeOffset.Now.Offset);
quarterDate = quarterDate.AddSeconds(3);
Console.WriteLine(quarterDate);
}
}
The code above generates the following result.