[Lazarus] DateDif function needed
JohnML at online.de
Mon Nov 11 13:54:39 CET 2013
On 11.11.2013 13:31, waldo kitty wrote:
> On 11/11/2013 3:39 AM, Michael Schnell wrote:
>> On 11/08/2013 09:35 PM, John Landmesser wrote:
>>> Result would be: 0 years, 0 moths, 11 days
>> IMHO a date diff in this format us desperately misleading, as the
>> count of days
>> in a month varies.
> understood but it is what many of us want for tasks of this nature...
> it means that one need know the numbers of days in the months between
> the dates so they can be properly counted... it also means knowing if
> a leap year is involved at some point...
> the *Span routines may be able to give us this info since they have
> fractional parts but as the code notes, starting with years or months
> values will result in an estimation...
.. still struggeling with a function DateDif( ANow, AThen: TDateTime) :
We have the functions YearsBetween, MonthsBetween, DaysBetween
YearSpan, MonthSpan, DaySpan
Test is: ANow := '01.01.2000'
AThen := '01.08..2001'
Result must(!!) be 1 year , 7 months, 0 days!!
I don't get it using mentioned functions?!!
I'll try again later :-((
More information about the Lazarus