Selecting proper week

  • Thread starter Thread starter Patrick Simonds
  • Start date Start date
P

Patrick Simonds

I have a dialog box with four calendars on it. What I need to have happen
is:

If I click on the second Thursday of a month on calendar1 then the second
Thursday of the month will be selected on the following calendar2. this is
easy enough with the following code:

Calendar2 = Calendar1 + 14

My problem is that if I select the 4th Thursday of the month (and it is
worth noting, only the second and 4th Thursdays are used) using the code
above will not necessarily get me the 2nd Thursday of the following month.
For example, if I select the 4th Thursday of march (2005) the code
"Calendar2 = Calendar1 + 14" gives me the 1st Thursday of April.

Any creative solutions are welcome.
 
Use the following logic:

if calendar1 and calendar1+7 are in different months, use calendar1+14
if calendar1 and calendar1+7 are in the same month, use calendar1+21

Have a good day
 
Back
Top