DateAdd +weeks dropping a few days
- From: Robert Zeurunkl <Robert.Zeurunkl.1mr4tm@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 31 Mar 2005 05:30:54 +0000
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
.
- Follow-Ups:
- Re: DateAdd +weeks dropping a few days
- From: Mike Painter
- RE: DateAdd +weeks dropping a few days
- From: BruceM
- Re: DateAdd +weeks dropping a few days
- From: Douglas J. Steele
- Re: DateAdd +weeks dropping a few days
- Prev by Date: Re: Another Form Question
- Next by Date: Re: How can I search a form without using FilterbyForm?
- Previous by thread: Re: DateAdd +weeks dropping a few days
- Next by thread: Re: DateAdd +weeks dropping a few days
- Index(es):
Relevant Pages
|