aqDateTime.AddMinutes Method

Applies to TestComplete 15.0, last modified on November 17, 2021

Description

The aqDateTime.AddMinutes method adds or subtracts the specified number of minutes to (from) the specified Date/Time value and returns the resultant date/time.

Declaration

aqDateTime.AddMinutes(InputDate, Minutes)

InputDate [in]    Required    Date/Time    
Minutes [in]    Required    Integer    
Result Date/Time

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

InputDate

Specifies the original date and time.

Minutes

Specifies the number of minutes to change. If Minutes is positive, then the given number is added. If Minutes is negative, then the given number is subtracted.

Result Value

The value of the Date/Time type that is earlier or later than InputDate by the number of minutes specified.

Example

The code below demonstrates how you can change a date and/or time by adding some values to it.

JavaScript, JScript

function ChangingTime()
{
  var Time1, Time2, Time3, Time4, Time5, Time6, Time7;

  Time1 = aqDateTime.Now();
  Time2 = aqDateTime.AddDays(Time1, 5);
  Time3 = aqDateTime.AddHours(Time1, 7);
  Time4 = aqDateTime.AddMinutes(Time1, 24);
  Time5 = aqDateTime.AddMonths(Time1, 2);
  Time6 = aqDateTime.AddSeconds(Time1, 15);
  Time7 = aqDateTime.AddTime(Time1, 9, 3, 24, 51);

  Log.Message(aqConvert.DateTimeToStr(Time1));
  Log.Message(aqConvert.DateTimeToStr(Time2));
  Log.Message(aqConvert.DateTimeToStr(Time3));
  Log.Message(aqConvert.DateTimeToStr(Time4));
  Log.Message(aqConvert.DateTimeToStr(Time5));
  Log.Message(aqConvert.DateTimeToStr(Time6));
  Log.Message(aqConvert.DateTimeToStr(Time7));
}

Python

def ChangingTime():
  Time1 = aqDateTime.Now()
  Time2 = aqDateTime.AddDays(Time1, 5)
  Time3 = aqDateTime.AddHours(Time1, 7)
  Time4 = aqDateTime.AddMinutes(Time1, 24)
  Time5 = aqDateTime.AddMonths(Time1, 2)
  Time6 = aqDateTime.AddSeconds(Time1, 15)
  Time7 = aqDateTime.AddTime(Time1, 9, 3, 24, 51)
  
  Log.Message(aqConvert.DateTimeToStr(Time1))
  Log.Message(aqConvert.DateTimeToStr(Time2))
  Log.Message(aqConvert.DateTimeToStr(Time3))
  Log.Message(aqConvert.DateTimeToStr(Time4))
  Log.Message(aqConvert.DateTimeToStr(Time5))
  Log.Message(aqConvert.DateTimeToStr(Time6))
  Log.Message(aqConvert.DateTimeToStr(Time7))

VBScript

Sub ChangingTime
  Dim Time1, Time2, Time3, Time4, Time5, Time6, Time7

  Time1 = aqDateTime.Now
  Time2 = aqDateTime.AddDays(Time1, 5)
  Time3 = aqDateTime.AddHours(Time1, 7)
  Time4 = aqDateTime.AddMinutes(Time1, 24)
  Time5 = aqDateTime.AddMonths(Time1, 2)
  Time6 = aqDateTime.AddSeconds(Time1, 15)
  Time7 = aqDateTime.AddTime(Time1, 9, 3, 24, 51)

  Log.Message aqConvert.DateTimeToStr(Time1)
  Log.Message aqConvert.DateTimeToStr(Time2)
  Log.Message aqConvert.DateTimeToStr(Time3)
  Log.Message aqConvert.DateTimeToStr(Time4)
  Log.Message aqConvert.DateTimeToStr(Time5)
  Log.Message aqConvert.DateTimeToStr(Time6)
  Log.Message aqConvert.DateTimeToStr(Time7)
End Sub

DelphiScript

procedure ChangingTime;
var Time1, Time2, Time3, Time4, Time5, Time6, Time7;
begin
  Time1: = aqDateTime.Now;
  Time2: = aqDateTime.AddDays(Time1, 5);
  Time3: = aqDateTime.AddHours(Time1, 7);
  Time4: = aqDateTime.AddMinutes(Time1, 24);
  Time5: = aqDateTime.AddMonths(Time1, 2);
  Time6: = aqDateTime.AddSeconds(Time1, 15);
  Time7: = aqDateTime.AddTime(Time1, 9, 3, 24, 51);

  Log.Message(aqConvert.DateTimeToStr(Time1));
  Log.Message(aqConvert.DateTimeToStr(Time2));
  Log.Message(aqConvert.DateTimeToStr(Time3));
  Log.Message(aqConvert.DateTimeToStr(Time4));
  Log.Message(aqConvert.DateTimeToStr(Time5));
  Log.Message(aqConvert.DateTimeToStr(Time6));
  Log.Message(aqConvert.DateTimeToStr(Time7));
end;

C++Script, C#Script

function ChangingTime()
{
  var Time1, Time2, Time3, Time4, Time5, Time6, Time7;

  Time1 = aqDateTime["Now"]();
  Time2 = aqDateTime["AddDays"](Time1, 5);
  Time3 = aqDateTime["AddHours"](Time1, 7);
  Time4 = aqDateTime["AddMinutes"](Time1, 24);
  Time5 = aqDateTime["AddMonths"](Time1, 2);
  Time6 = aqDateTime["AddSeconds"](Time1, 15);
  Time7 = aqDateTime["AddTime"](Time1, 9, 3, 24, 51);

  Log["Message"](aqConvert["DateTimeToStr"](Time1));
  Log["Message"](aqConvert["DateTimeToStr"](Time2));
  Log["Message"](aqConvert["DateTimeToStr"](Time3));
  Log["Message"](aqConvert["DateTimeToStr"](Time4));
  Log["Message"](aqConvert["DateTimeToStr"](Time5));
  Log["Message"](aqConvert["DateTimeToStr"](Time6));
  Log["Message"](aqConvert["DateTimeToStr"](Time7));
}

See Also

Working With Dates
Working With Time
AddTime Method
AddMonths Method
AddDays Method
AddHours Method
AddSeconds Method
TimeInterval Method

Highlight search results