20. august 2004 - 12:36Der er
3 kommentarer og 1 løsning
År mellem birthday date1
Jeg har prøvet med var dato:Real; birthday:TdateTime; begin Birthday := StrToDate('20-08-1974'); dato := Int(date)-Int(Birthday); dato := TRUNC(dato / 365); Label1.Caption := FloatToStr(dato); end;
function YearsBetween(const ANow, AThen: TDateTime): Integer;
C++ syntax:
extern PACKAGE int __fastcall YearsBetween(const System::TDateTime ANow, const System::TDateTime AThen);
Description
Call YearsBetween to obtain the difference, in years, between two TDateTime values. Because years are not all the same length (e.g. leap years), YearsBetween returns an approximation based on an assumption of 365.25 days per year. Fractional years are not counted. Thus, for example, YearsBetween reports the difference between Jan 1 and Dec 31 as 0 on non-leap years and 1 on leap years.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.