[Lazarus] DateDif function needed

waldo kitty wkitty42 at windstream.net
Wed Nov 13 21:15:22 CET 2013

On 11/13/2013 1:42 PM, Reimar Grabowski wrote:
> On Tue, 12 Nov 2013 22:00:39 +0100 (CET)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>> Seeing this, I can't help but think that the approximation approach
>> may not be such a bad idea after all :D
> Can you elaborate what the approximation is? I fail to see it.
> 1 julian year = 365.25 days of 86400 SI seconds each.

from dateutil.inc (line ~64)...


   { Average over a 4 year span. Valid for next 100 years }
   ApproxDaysPerMonth: Double = 30.4375;
   ApproxDaysPerYear: Double  = 365.25;

> Of course there are lots of other definitions for year but if FPC uses the
> julian one the value is exact and no approximation. And it is one of the
> year definitions that make sense as a unit of time (in contrast to calendar
> year ...)

the problem is that knowing the (eg) YearsBetween or YearsSpan does not easily 
lend itself to being able to determine the remainder Months, Days, Hours, 
Minutes, Seconds... the same with MonthsBetween or MonthSpan... Days is known 
and can be used for the other finer values but you also cannot use it to build a 
months or years value that works out properly with the other values...

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