Recent

Author Topic: YearsBetween not work!  (Read 4470 times)

golconda82

  • Newbie
  • Posts: 1
YearsBetween not work!
« on: June 05, 2010, 04:08:15 am »
Hi friends, I have a problem with this function and I don't know why don't work...

Code: [Select]
Label2.caption:=YearsBetween('20/05/1982', '20/05/2010');
The error message is: unit_principale.pas(37,31) Error: Identifier not found "YearsBetween"

Teh question is:"Why?"  :'(

Thanks

motaz

  • Sr. Member
  • ****
  • Posts: 495
    • http://code.sd
Re: YearsBetween not work!
« Reply #1 on: June 05, 2010, 05:11:18 am »
First add DateUtils to uses clause, then call the function like that:

Code: [Select]
var
  First, Second: TDateTime;
begin
  First:= Now;
  Second:= EncodeDate(2000, 1, 1);

  Label1.caption:= IntToStr(YearsBetween(First , Second)); 
end;


 

TinyPortal © 2005-2018