hidrau
asked on
How inc ddd hh:mm:ss into my datetime?
Hello guys
I have a maskedit where I inform ddd hh:mm:ss and I want to inc my date, I tried this code and it works fine for days but not
for hours :(
For example: 001 02:35:40 add to my date 07/11/2017 13:00:00
Whats is wrong? any clue for a better way?
thanks
Alexandre
I have a maskedit where I inform ddd hh:mm:ss and I want to inc my date, I tried this code and it works fine for days but not
for hours :(
For example: 001 02:35:40 add to my date 07/11/2017 13:00:00
procedure TFDatasPrevisao.MaskEdit1Exit(Sender: TObject);
var
dias, horas, minutos, segundos : String;
Dt : TDateTime;
begin
Dt := MaskEdit1.DateTime;
Dias := Copy(MaskEdit3.text, 1,3);
Horas := Copy(MaskEdit3.text, 5, 2);
Minutos := Copy(MaskEdit3.text, 8, 2);
segundos := Copy(MaskEdit3.text, 11, 2);
if StrToInt( dias ) > 0 then
Begin
dt := IncDay(dt, StrToInt( dias ))
End;
if StrToInt( horas ) > 0 then begin
dt := IncHour(dt, StrToInt( horas ))
end;
if StrToInt( minutos ) > 0 then begin
dt := IncMinute(dt, StrToInt( minutos ));
end;
MaskEdit2.Date := dt;
end;
Whats is wrong? any clue for a better way?
thanks
Alexandre
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER