No.  There is no standard Delphi method to do what you're talking about,
because it's not actually possible.  The number is a real number of days,
and can't be converted verbatim into years, months and days, because to do
that you need to know the date on which you begin.  A value of 31 counted as
0 years, 1 month and 1 day last month, but as 0 years, 1 month and 0 days
this month.  If I go Decode(31, Years, Months Days);, then which is correct?
Depends when you start because every month and year is different.

You were trying to go Decode(TDateTime(31), Years, Months, Days).
Subtracting 30/12/1899 from the Years won't help - not unless you always
want your age calculated as X days from 30/12/1899 (a date's idea of 0).

Cheers,
Carl

> -----Original Message-----
> From: Patrick Dunford [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 17 December 1999 14:39
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Date/Time calculations
> 
> The point you're missing is that the number is supposed to be 
> convertible
> into a number of years, months and days, but the standard 
> routine Delphi
> provides for doing this adds an offset of 30/12/1899 to it. 
> Delphi does not
> provide any other routine for so doing.

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to