[Lazarus] DateDif function needed

Reinier Olislagers reinierolislagers at gmail.com
Sat Nov 16 18:27:31 CET 2013

On 16/11/2013 18:21, Michael Van Canneyt wrote:
> On Fri, 15 Nov 2013, Bart wrote:
>> 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.

A suggestion if I may: given the wide variation of possibilities of
interpretation, some comments in the code about how the calculation is
supposed to work would be very much appreciated, I'm sure.
(Of course, that applies even more to added documentation).

Just wanted to avoid another huge thread discussing PeriodBetween in
future... as well as confusion on the part of possible users in general.


More information about the Lazarus mailing list