Time comparison in delphi

It's simple!

Suppose data 1, data2 data2 has two datetimepickers, with Edit as the name …btn as the button to store the database …db as the database.

It is first defined in the onchange event of data 1.

begin

if data 1 . datetime & gt; So data2.datetime

begin

data 1 . datetime:= data 2 . datetime;

Showmessage ('Incoming time cannot be later than outgoing time!' );

End;

In onchange of data2.

begin

If data2.datetime & lt date 1. So the date and time

begin

data 2 . datetime:= date 1 . datetime;

Showmssage ('factory delivery time cannot be earlier than factory arrival');

End;

Btn.onclick event

begin

If data2.datetime & lt Then data 1.datetime

begin

Showmessagae ('Timing error, please try again ...!' );

export

other

begin

db.post

End;

End;