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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version