[Lazarus] DateDif function needed

Frederic Da Vitoria davitofrg at gmail.com
Tue Nov 12 13:09:00 CET 2013


2013/11/12 Michael Van Canneyt <michael at freepascal.org>

>
> On Tue, 12 Nov 2013, Jürgen Hestermann wrote:
>
>  Am 2013-11-11 17:25, schrieb Michael Van Canneyt:
>>
>>> The number of elapsed DAYS between these 2 dates is 60.
>>> If the average number of days per month is assumed to be 30.4375, then 2
>>>
>> full months would be 60.875 days.
>>
>>> That means that 60 days DOES NOT span 2 full months of 30.4375 days: it
>>>
>> falls 0.875 days short for that.
>>
>>> Hence, the *intended* result is 1.
>>>
>>
>> But dates from the 1st of a month to the 1st of the next month
>> should be considered to span a full month, shouldn't it?
>> If not, of what use would it be?
>> A month is *not* defined to be 30.4375 days.
>> Getting an average months is completely useless IMO.
>> Who wants to get such a result for what purpose?
>>
>
> Like I said: you can argue whether the functions are useful.
> They are there for Delphi compatibility.
>
> Feel free to provide other functions, I will happily accept them.
>

If I am not mistaken, Bart just provided one :-) I suggest using another
more discriminant name instead of DateDiff, something like AgeBetween or
ExactDateDiff.

-- 
Frederic Da Vitoria
(davitof)

Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20131112/cb7f63a9/attachment-0003.html>


More information about the Lazarus mailing list