Date Evaluation - Max days in a given month?

T

Tim

Can someone tell me a method of returning the total # of days for a given
month, when that month is not the current month necessarily.

I'm trying to filter a date field to a given month that is always 3 months
prior to the current month. So for example, since it is currently July, I
would like my filter to say "Between 4/1/05 and 4/30/05". It's the 30
that's difficult for me. Since of course next month the same filter should
look to 31 (for May), and only to 28 or 29 in February.

Certainly their is already standard methods for this that I'm just missing?

Thanks for any direction!

Tim
 
R

RuralGuy

Tim said:
Can someone tell me a method of returning the total # of days for a
given month, when that month is not the current month necessarily.

I'm trying to filter a date field to a given month that is always 3
months prior to the current month. So for example, since it is
currently July, I would like my filter to say "Between 4/1/05 and
4/30/05". It's the 30 that's difficult for me. Since of course next
month the same filter should look to 31 (for May), and only to 28 or
29 in February.

Certainly their is already standard methods for this that I'm just
missing?

Thanks for any direction!

Tim

Hi Tim,

DateSerial(year, month, day) should do it for you.

If you specify Day=0 you will get the last day of the previous month.

hth
 
T

Tim

Well, disregard, in case you'd like to post some better methods. This
worked for me:

Between DateAdd("m",-3,Date())-Format(Date(),"d")+1 And
DateAdd("m",-2,Date())-Format(Date(),"d")
 
J

John Griffiths

DateSerial(Year(Date()), Month(Date())-3, 1)
and
DateSerial(Year(Date()), Month(Date())-2, 1)-1

Also work - John
 
Top