[Lazarus] DateDif function needed

waldo kitty wkitty42 at windstream.net
Sat Nov 9 19:40:10 CET 2013


On 11/9/2013 12:59 PM, J├╝rgen Hestermann wrote:
> Am 2013-11-09 18:42, schrieb waldo kitty:
>  >
> Result:=Trunc(((Abs(MyDateTimeDiff(ANow,AThen))+TDateTimeEpsilon)/ApproxDaysPerYear)+0.5);
>
>  > end;
>
> I thought that correct results should be calculated, not only "approximate" values.
> What is "ApproxDaysPerYear"?
> A leap year has 266 days and others 365 and this should be considered.
> Calculations based on floats seem not very reliable.

from DateUtil.inc

[quote]
Const

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

of course, the question is now "what is the starting and ending points of 'next 
100 years'?"... ideally it should state the range of years that it is valid for, 
shouldn't it?? ;)

-- 
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