C# DateTime AddMinutes

Description

DateTime AddMinutes returns a new DateTime that adds the specified number of minutes to the value of this instance.

Syntax

DateTime.AddMinutes has the following syntax.


public DateTime AddMinutes(
  double value
)

Parameters

DateTime.AddMinutes has the following parameters.

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

Returns

DateTime.AddMinutes method returns An object whose value is the sum of the date and time represented by this instance and the number of minutes represented by value.

Example

The following example uses the AddMinutes method to add a number of whole and fractional values to a date and time.


using System;// w ww .ja va 2s  . c  o  m

public class Example
{
   public static void Main()
   {
      DateTime dateValue = new DateTime(2013, 9, 15, 12, 0, 0);

       Console.WriteLine(dateValue.AddMinutes(3));
   }
}

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