[Lazarus] DateDif function needed

Patrick Chevalley pch at ap-i.net
Thu Nov 14 07:56:16 CET 2013


Hi,

> So the difference between 2007-01-01 12:00 and 2008-01-01 12:00 ist
> *not* one year?

No, the base definition of the year is not a digit change, but the time 
it take to the Earth to return at the same point of its orbit around the 
Sun.
This is actually 365.2422 days, and this is named the tropical year.
The julian year of 365.25 is a convenient approximation still in use 
despite the julian calendar was abrogated some 400 years ago.

All this efforts are to bypass the problem with the calendar year (the 
one you mention) because it is sometime 365 and sometime 366 days. This 
is a totally unacceptable definition when you need an homogeneous time 
scale.

So all depend of the use you need for your application  and it must be 
admitted that one set of definition/function is not sufficient and every 
one must be careful when using time period.

For me the very simple functions as implemented if FPC are sufficient, 
the most important here is Delphi compatibility. And you need to provide 
your own if you need something more specific, such writing a calendar 
application.

Patrick





More information about the Lazarus mailing list