كود :
uses DateUtils;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var DateNow, AliasDateNow, MyDateUser : TDateTime;
DifferenceBetween : Integer;
begin
{two functions take two parameters constant,
as you see they have the circuit parameters for variabilize it,
otherwise we expected to erroneous results.}
AliasDateNow := TDateTime(Now);
ShowMessage(DateToStr(AliasDateNow));
MyDateUser := StrToDate('06/01/2012'); // For example
if CompareDate(AliasDateNow, MyDateUser)>= 0 then
DifferenceBetween := DaysBetween(AliasDateNow, MyDateUser) else
{if not we change the two variables}
DifferenceBetween := DaysBetween(MyDateUser, AliasDateNow);
ShowMessage(IntToStr(DifferenceBetween));
end;
