Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Decision based on week of the month



I have a support team that wants to rotate on-call based on the week of the month. 


Weeks 1 - 4 route to different people based on the time of day. How can I 'count' the week of the month? One thought is to populate an external document, but that needs to be maintained yearly. Can I use some other logic to get the date, and perhaps count the day of the year and make a decision  based on that?




  • Contact Center

This is an interesting

This is an interesting question...and at the moment I can't think of a solution outside your parameters..Here is what I would do..if you have the proper licenses.

//Create a New Calendar Object
java.util.Calendar cal = getInstance();
//Set the Day of the Week to Monday for Our Purposes
cal.set(cal.DAY_OF_WEEK, 2);
//Count which Monday 1-x we are in the Month
int weekMon = cal.get(cal.DAY_OF_WEEK_IN_MONTH);

Now perform your Logic..

    case 1://Fall Through
    case 2://Set Logic
        //Route To Group 1
        break; //Go do that Thing
    case 3: //Fall Through
    case 4: //Set Logic
        //Route to Group 2
        break; //Go do work
        //Some Months have more Mondays than Others..What will we do?
        //No need to "break" here

This is really to just get you started thinking about how to tackle your problem..there are some slight issues with the logic above (maybe). It get's somewhat tricky at the end/beginning of the Month..for instance..if the Logic fell on March 1 then setting the Day of Week to Monday would have made us go back to Feb 24..but you would still fall in "Week 4" according to the Week of Month Logic..even though we are now in a new month..Good luck in your testing..