06-12-2014, 08:41 PM
الخطا بسيط يا اخي اسم الدالة هو Years وليس YearsBetween غير الكود ليصبح
PHP كود :
function Years(PastDate,CurrentDate:TDate):integer;
var
PastMonth,PastDay,PastYear,CurrentYear,CurrentMonth,CurrentDay:word;
begin
DecodeDate(PastDate,PastYear,PastMonth,PastDay);
DecodeDate(CurrentDate,CurrentYear,CurrentMonth,CurrentDay);
if (PastYear=CurrentYear) and (PastMonth=CurrentMonth) and (PastDay=CurrentDay) then
Result:=0
else
begin
Result:=CurrentYear-PastYear;
if (PastMonth>CurrentMonth) then
Dec(Result)
else
begin
if PastMonth=CurrentMonth then
if (PastDay>CurrentDay) then
Dec(Result);
end;
end;
end;
procedure TForm1.edt1Change(Sender: TObject);
var
date1, date2: TDate;
begin
date1 := StrTofloat(Edt1.Text);
date2 := Now;
Edt2.Text:= FloatToStr(Years(date2, date1));
end;
end.
و من طلب العلوم بغير كد _________ سيدركها إذا شاب الغراب

