Does anyone know if the MinutesBetween error has been fixed in Delphi 7?
By putting a button and two edit boxes on a screen, we get this problem (it also occurs in our real application, which is how we found it):
If you enter 08:00 in edit1 and 07:40 in edit2, Minutes between returns 20, which is correct. If you enter any number between 07:42 and 07:59, the value is off by 1. This is the case in a large number of cases.
procedure TfrmMain.Button1Click(Sender: TObject);
var
DateTime1:TDateTime;
DateTime2:TDateTime;
begin
DateTime1 := StrToTime(Edit1.text);
DateTime2 := StrToTime(edit2.text);
Showmessage(IntToSTr(DateUtils.MinutesBetween(DateTime1,DateTime2)));
end;
Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
By putting a button and two edit boxes on a screen, we get this problem (it also occurs in our real application, which is how we found it):
If you enter 08:00 in edit1 and 07:40 in edit2, Minutes between returns 20, which is correct. If you enter any number between 07:42 and 07:59, the value is off by 1. This is the case in a large number of cases.
procedure TfrmMain.Button1Click(Sender: TObject);
var
DateTime1:TDateTime;
DateTime2:TDateTime;
begin
DateTime1 := StrToTime(Edit1.text);
DateTime2 := StrToTime(edit2.text);
Showmessage(IntToSTr(DateUtils.MinutesBetween(DateTime1,DateTime2)));
end;
Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole