[Lazarus] DateDif function needed
Jürgen Hestermann
juergen.hestermann at gmx.de
Thu Nov 14 18:48:07 CET 2013
Am 2013-11-14 07:56, schrieb Patrick Chevalley:
>> 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.
Well, *this* value (earth at the same point) is also varying. When doing astronomical calculations I would definitely not use a fixed value.
> The julian year of 365.25 is a convenient approximation still in use despite the julian calendar was abrogated some 400 years ago.
Of what use would it be to use 365.25 days as a representation of a year? You can also use 400 instead. It would be just an arbitrary definition decoupled from calendars. You cannot calculate anything useful with it. Neither calendar dates nor astronomical things. It is just an accademic value and exists only because it is "so easy to use".
> 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.
Well, that's just the whole point of this thread: The time scale we are talking about here is *not* homogeneous! Instead, a synchronization with calendar dates is wanted/needed. That has always been a problem with calendar definitons. The rotation of earth around the sun is not a whole-numbered multiple of its rotation around itself but we want a whole number of days (otherwise day time would no longer be related to sunlight). So we synchronize our calendar with the run of the sun by leap days (and leap seconds). But now years and months are no longer a fixed value. Therefore differences must be calculated in a more complex way based on dates and not as a fixed number of (milli)seconds. It's easy to use fixed values for day, month, year but it is of no use when talking about calendars.
> 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.
Just give me an example where a fixed value for a month is of use? If you rent an appartement you will definitely not be able to insist on your fixed definition of a month (i.e., when starting on february the 1st). In daily usage the time ranges vary depending on the month you look at.
> For me the very simple functions as implemented if FPC are sufficient,
In what context do you use these functions?
More information about the Lazarus
mailing list