Bill Wilkinson - GetQuarter has errors

# Thread: Bill Wilkinson - GetQuarter has errors

1. One Tired Individual Guest

## Bill Wilkinson - GetQuarter has errors

The code to retrieve the quarter that the current date is in that you gave to me the other night yields the following:<BR>1/1/2001 to 12/31/2000 (instead of 4/1/2001 to 6/30/2001)<BR>Since I don&#039;t know anything about this code, and I could fiddle with it a million ways and not get the right answer, I was hoping you would be able to see the problem.<BR>&#039; get 0 to 3 as quarterNumber <BR>quarterNumber = ( Month(today) - 1 ) 4 &#039; use a backslash<BR>firstDayOfQuarter = DateSerial( Year(today), Month( 4 * quarterNumber + 1 ), 1 ) <BR>lastDayOfQuarter = DateSerial( Year(today), Month( 4 * quarterNumber + 4 ), 0 )<BR>Thanks!

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## I yam a dork!

Sorry!<BR><BR>&#060;%<BR>...<BR>firstDayOfQuarter = DateSerial( Year(today), 3 * quarterNumber + 1, 1 ) <BR>lastDayOfQuarter = DateSerial( Year(today), 3 * quarterNumber + 4, 0 ) <BR>...<BR>%&#062;<BR><BR>I had Month(4 * quarterNumber + 1) !!!<BR><BR>So I was trying to get the Month *of* something that was already a Month! Duhhhhh!!<BR><BR>And then on top of it, I was putting FOUR MONTHS in each quarter!!! Double DUH!<BR><BR>Geez...put this senile old fart out to pasture.<BR><BR><BR>

3. One Tired Individual Guest

## Hey cool...

Your explanation in the previous post has enlightened my understanding of exactly what the code does. Thanks Bill!<BR>And after all, you did post that code at midnight so we&#039;ll chalk it up to being tired, not senile ;)<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•