Re: DateTime fraction year

[email protected] (Eric Brine) Sat, 4 Jul 2015 23:38:58 -0400
Newsgroups perl.datetime
Message-ID <CALJW-qE1nYsHPB_9th5r8ckOCgpQ=J3MG6LhziR5YtxFEzNF1w@mail.gmail.com>
On Fri, Jul 3, 2015 at 12:27 PM, <[email protected]> wrote:

> I have a need to compute a year with fraction between two dates.
>
> Meaning date 1 = 2005-05-04 date 2 = 2015-05-06 then the year I’m after is
> 10.0054794520548.
>
> My thinking on the above is neither 2005 or 2015 is a leap year so I
> should use a devisor of 365 days and the number of days extra between the
> above two dates is 2 so 2/365 is 0.0054794520548.
>
> Based on the above thinking I need to determine two things to do the above
> generically.
>
> 1) what devisor to use 365 or 366 (depends on if either the start or end
> year is a leap year)
>
> 2) exactly how many days exist between the start date and end date minus
> all the extra years.
>

What about the number of hours in the day? That varies for some days in
many time zones.