SmartPascal
IncMinute
Function
Increments a TDateTime variable by + or - number of minutes DateUtils unit
 function IncMinute ( const StartDateTime : TDateTime {; NumberOfMinutes : Integer = 1} ) : TDateTime;
Description
The IncMinute function returns a TDateTime value that is NumberOfMinutes greater than the passed StartDateTime value.
 
The year, month, day and hour values are incremented as appropriate.
 
The increment value is optional, being 1 by default.
Notes
There is no DecMinute function.

Instead, use IncMinute with a negative increment.
Related commands
IncDay Increments a TDateTime variable by + or - number of days
IncMonth Increments a TDateTime variable by a number of months
IncYear Increments a TDateTime variable by a number of years
IncSecond Increments a TDateTime variable by + or - number of seconds
IncMillisecond Increments a TDateTime variable by + or - number of milliseconds
 
Example code : A simple example of increment and decrement
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  DateUtils,   // Unit containing the IncMinute command
  SysUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  myDate : TDateTime;
begin
  // Set up our date just before the end of the year 2000
  myDate := EncodeDateTime(2000, 12, 31, 23, 0, 0, 0);
  ShowMessage('myDate = '+DateTimeToStr(myDate));

  // Add 100 minutes to this date
  myDate := IncMinute(myDate, 100);
  ShowMessage('myDate + 100 minutes = '+DateTimeToStr(myDate));

  // Subtract 40 minutes from this date
  myDate := IncMinute(myDate, -40);
  ShowMessage('myDate -  40 minutes = '+DateTimeToStr(myDate));
end;
 
end.
Hide full unit code
   myDate = 31/12/2000 23:00:00
   myDate + 100 minutes = 01/01/2001 00:40:00
   myDate -  40 minutes = 01/01/2001