main logo
Subject: RE: Date calculations.
Author: "Sietse Wijnker"
Posted: 2007/03/31 14:39:11
 
View Entire Thread
New Search


Good point!

Thanks for your input.
Sietse

-----Oorspronkelijk bericht-----
Van: profoxtech-bounces (AT) leafe D.O.T com [mailto:profoxtech-bounces@leafe.com]
Namens Ted Roche
Verzonden: vrijdag 30 maart 2007 15:11
Aan: profoxtech (AT) leafe D.O.T com
Onderwerp: Re: Date calculations.

On 3/30/07, Sietse Wijnker <sietse.wijnker@sw-software.nl> wrote:

> Hmm, the start date isn't relevant.

I think start date is relevant.

1. How many months and days are there in 59 days if you start on January
1st?

2. How about 62 days?

3. What if you start on January 15th?

4. June 1st? June 15th? June 30th?

"It depends."

A1: Two months, or one month and 29 days, depending on leap year.

A2. Two months three days or two months, two days, ditto.

3. Same problem, leap day.

4. A different problem: depending on where you start in the month and
how long the months are you traverse, you could end up with a
different number of months and a different remainder of days.

The question of "How many years, months and days in 500 days" has no
answer without a base date. You can't even answer "years and days"
unless you can tell me how many days there are in "a" year.

The quick answer: use 365.25 for years and 30.4375 for days and return
the answer as "approximate"

#DEFINE DaysInYear 365.25
#DEFINE DaysInMonth 30.4275

* Given d=397, the number of days:

nYears = INT(d/DaysInYear)
nMonths = INT((d-nYears*DaysInYear)/DaysInMonth)
nDays = INT(d-(nYears*DaysInYear)-(nMonths*DaysInMonth))



--
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com


[excessive quoting removed by server]


 
©2007 Sietse Wijnker
<-- Prior Message New Search Next Message -->