On Fri, 15 Nov 2013, Bart wrote:

On 11/15/13, Michael Schnell <mschn...@lumino.de> wrote:

In fact I consider it a waste of bandwidth to discuss a problem that
obviously is not solvable at this length. (But who am I do complain
about that :-[ .)


Of course it can be solved.
Just add a enough options (appr. 255?) to the procedure to make it
behave just like the caller wants.
Do I want to do that? No.  ;-)

The fun part for me is the fact that a seemingly simple question,
where at first glance you would think "I'll just implement that", can
lead to so many "problems".

I added a modified version of your implementation to the DateUtils unit as:

Procedure PeriodBetween(Const ANow, AThen: TDateTime; Out Years, months, days : 
Word);

I chose this name because it is more in line with the existing XXXBetween 
functions.

I did change the algorithm so it does not do the correction for february of the 
leap year.
It returns now the same results as the Jedi function. (which I didn't take for 
license reasons)

Thanks for providing an implementation.

Michael.

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to