[Lazarus] DateDif function needed

waldo kitty wkitty42 at windstream.net
Thu Nov 14 16:16:06 CET 2013


On 11/14/2013 8:16 AM, Mattias Gaertner wrote:
> On Thu, 14 Nov 2013 13:48:46 +0100
> John Landmesser <JohnML at online.de> wrote:
>
>> [...]
>> "Our" function delivers the age of a person in years, months, days.
>
> What is your diff between 31th Jan and 30 March 2013?

the one i am currently testing returns

   2013-01-31 to 2013-03-30 is    0 yrs    1 mos   30 days


FWTW, too ;)

leapyear:
   2012-01-31 to 2012-03-30 is    0 yrs    1 mos   30 days

non-leapyear to leapyear:
   2011-01-31 to 2012-03-30 is    1 yrs    1 mos   30 days

leapyear to non-leapyear:
   2012-01-31 to 2013-03-30 is    1 yrs    1 mos   30 days

non-leapyear thru leapyear to non-leapyear:
   2011-01-31 to 2013-03-30 is    2 yrs    1 mos   30 days

leapyear thru non-leapyear to non-leapyear:
   2012-01-31 to 2014-03-30 is    2 yrs    1 mos   30 days


the whole of Feb is counted as a month no matter how many days it has...

-- 
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