function for date of first and last day through weeknumber

P

Peeters

given: weeknumber and year
I want to know :
the date of the sunday (1st day of week) of the given weeknumber
the date of the saturday (7th day of week) of the given weeknumber

Is there anyone who can give me vba code for such functions?

tks
Michel
 
V

vanderghast

Given any date, assuming weeks run from Sunday to Saturday, its Sunday is

x + 1 - DatePart("w", x)

and its Saturday is

x + 7 - DatePart("w", x)


To get a date in the n-th week of the year ( n >= 1 ):

dateadd( "ww", n-1, dateSerial( 2010, 1, 1))


which become the "x" in the previous expression(s).

(That assumes that the first of January is in the first week of the year,
not necessary a convention which is right everywhere).


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