DateAdd +weeks dropping a few days




This one actually got interesting. After a bit of research, here's what
I found:

Starting with 1/1/2005, and adding years (52 weeks at a time), I get
the following results:

1 Week: 12/31/2005 -0 days
2 Weeks: 12/30/2006 -1 days
3 Weeks: 12/29/2007 -2 days
4 Weeks: 12/27/2008 -4 days
5 Weeks: 12/26/2009 -5 days
6 Weeks: 12/25/2010 -6 days
7 Weeks: 12/24/2011 -7 days
8 Weeks: 12/22/2012 -9 days
9 Weeks: 12/21/2013 -10 days
10 Weeks: 12/20/2014 -11 days


I think what happens is that I loose one day PER YEAR because I add the
year, but not the extra DAY to bump me over to the next year. Then you
notice that I lose an EXTRA day in 2008 and 2012. Both leap years. SO
leap years are partially at the root. How bout that?

Finally, 2014 IS a leap year, but nothing odd happens because we don't
get to it. My test date is january 1.

In the end, I needed to take the results from DateAdd() and add one day
for each year spanned, but also one day for each leap year encountered
in the date range.

B.





Rick B Wrote:
> I could be wrong, but this seems to work for me.
>
> item one (adding 52 weeks) results in the same day next year (minus 1)
>
> item two (adding 104 weeks) results in the same day next year (minus
> 1),
> then the same day the following year (minus1) Result= same day two
> years
> from now (minus2).
>
> In short, you are adding 364 days for every 52 weeks.
>
> 52 weeks loses one day
> 105 weeks loses two days
> 157 weeks loses three days
> etc.
>
> I could be wrong, but this seems to make perfect sense to me.
> Mathmatically, at least.
>
> Now, It is odd that adding 52 weeks results in a different date than
> adding
> one year. I never thought about the fact that a year is actually 52
> weeks
> and one day!
>
> Rick B
>


--
Robert Zeurunkl
.



Relevant Pages

  • Re: DateAdd +weeks dropping a few days
    ... (no e-mails, please!) ... Both leap years. ... > Finally, 2014 IS a leap year, but nothing odd happens because we don't ... > Rick B Wrote: ...
    (microsoft.public.access.forms)
  • Re: Help in determining age
    ... What I was supposedly thinking about was the 10-day adjustment to the calendar and the new Leap Year calculations that Pope Gregory came up with... ... Rick ... ># Name DOB Inauguration date Inauguration age ...
    (microsoft.public.excel.programming)
  • RE: DateAdd +weeks dropping a few days
    ... "Robert Zeurunkl" wrote: ... Both leap years. ... > Finally, 2014 IS a leap year, but nothing odd happens because we don't ... > Rick B Wrote: ...
    (microsoft.public.access.forms)
  • Re: AND and OR and parentheses
    ... rick wrote: ... > given that the AND operator has higher precedence than OR, ... programmers often get wrong. ... This expression gives the same value to `leap' as the first ...
    (comp.lang.c)
  • Re: Days to next anniversary
    ... Biff's subsequent modifications to it, do get tripped up by a start date of ... ALL of the formulas submitted so far will produce an incorrect calculation if the TODAY date is anywhere within the range of January 1st to February 28th of a NON leap year and the start date is any day on or after March 1st of a leap year... ... and this missing day is carried forward for Start Dates up to and including December 31, ... Rick ...
    (microsoft.public.excel.misc)