C# DateTimeOffset AddMinutes

Description

DateTimeOffset AddMinutes adds a specified number of whole and fractional minutes to the current DateTimeOffset object.

Syntax

DateTimeOffset.AddMinutes has the following syntax.


public DateTimeOffset AddMinutes(
  double minutes
)

Parameters

DateTimeOffset.AddMinutes has the following parameters.

  • minutes - A number of whole and fractional minutes. The number can be negative or positive.

Returns

DateTimeOffset.AddMinutes method returns An object whose value is the sum of the date and time represented by the current DateTimeOffset object and the number of minutes represented by minutes.

Example


using System;/*  ww  w.j ava2  s . com*/

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.AddMinutes(8);
    
    Console.WriteLine("Shifts for the week of {0:D}", startOfShift);
  }
}

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