Table of Content
HAL Forum
function Time AddHours (
Time time,Longint number)
Description:
Increases or decreases the hour part of a given time
Parameters:
time the time to convert
number numbers of hours to add or subtract
procedure CheckTimeMinSec(var Time timep)
begin
  if (GetSecond(timep)>=60) then begin
    timep = AddMinutes(timep,1);                     // Adds one minute to the time "timep"
    timep = AddSeconds(timep,-GetSecond(timep));     // Subtracts all the seconds from the time "timep"
  end;
  if (GetMinute(timep)>=60) then begin
    timep = AddHours(timep,1);                       // Adds one hour to the time "timep"
    timep = AddMinutes(timep,-GetMinute(timep));     // Subtracts all the minutes from the time "timep"
  end;
  return;
end;

// You can now also use timep.hour = timep.hour + 1 if you like
Related topics:
««