Finding out what week of the month a date is.

M

Mike Coleman

I have a general date in a textbox say 06/08/2009 12:00 am. You and I can
look on a calender and see that 06/08 is the second week of june. I am
wondering if there is a function that will return 0602 if I pass it a general
date?

Please help.

Mike
 
V

vanderghast

1+ DatePart("ww", yourDate - DatePart("ww", DateSerial(Year(YourDate),
Month(YourDate), 1 ))


should do.

Note that this way, the first week of June 2009 is ALSO the 6th week of May
2009 (i.e. 1 == 6 ), so, that way of naming weeks is to avoid if you want
to GROUP BY on week (a given week having two different "names").



Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top