function for date of first and last day through weeknumber

  • Thread starter Thread starter Peeters
  • Start date Start date
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
 
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
 
Back
Top