[Lazarus] DateDif function needed

waldo kitty wkitty42 at windstream.net
Sat Nov 9 15:20:42 CET 2013


On 11/9/2013 12:55 AM, leledumbo wrote:
> uses
>    SysUtils;
> var
>    Date1,Date2: TDate;
>    Y,M,D: Word;
> begin
>    Date1 := EncodeDate(2012,12,21);
>    Date2 := EncodeDate(2013,01,01);
>    DecodeDate(Date2 - Date1,Y,M,D);
>    // you have them in Y, M and D, respectively
> end.

yeah, that doesn't work...

Y = 1900
M = 1
D = 10

Y should be 1 in this case...

ideally, real numbers would be used so that fractions of years, months and days 
can be determined ;)

-- 
NOTE: No off-list assistance is given without prior approval.
       Please keep mailing list traffic on the list unless
       private contact is specifically requested and granted.




More information about the Lazarus mailing list