01-02-2014 01:35 PM - edited 03-16-2019 09:05 PM
I just started working on a script on UCCX, and the office I'm writing the script for has the hours of 7:00am to 4:30pm M-F. However, on the first Wednesday of every month, their hours are 7:00am to 12:00pm. Is there any way I can write an *if, then* script to show this?
Solved! Go to Solution.
01-03-2014 12:10 AM
Hi Eileen.
You can calculate it direct through a boolean variable in the script, or you can call an external XML.
I found esier to calculate it as follows
Define a bolean variable eg. called FirstWednesday
Than add a "SET" step in your script
Set FirstWednesday = {
java.util.Calendar calendar = new java.util.GregorianCalendar();
calendar.setTime(new java.util.Date());
if (calendar.get(java.util.Calendar.DAY_OF_WEEK) == java.util.Calendar.WEDNESDAY && (
calendar.get(java.util.Calendar.DAY_OF_WEEK_IN_MONTH) == 1
)
) {
return true;
} else {
return false;
}
}
The value FirstWednesday will return true or false and , with this value, you can apply an if step setting the right time
HTH
Regards
Carlo
Please rate all helpful posts
"The more you help the more you learn"
01-03-2014 12:10 AM
Hi Eileen.
You can calculate it direct through a boolean variable in the script, or you can call an external XML.
I found esier to calculate it as follows
Define a bolean variable eg. called FirstWednesday
Than add a "SET" step in your script
Set FirstWednesday = {
java.util.Calendar calendar = new java.util.GregorianCalendar();
calendar.setTime(new java.util.Date());
if (calendar.get(java.util.Calendar.DAY_OF_WEEK) == java.util.Calendar.WEDNESDAY && (
calendar.get(java.util.Calendar.DAY_OF_WEEK_IN_MONTH) == 1
)
) {
return true;
} else {
return false;
}
}
The value FirstWednesday will return true or false and , with this value, you can apply an if step setting the right time
HTH
Regards
Carlo
Please rate all helpful posts
"The more you help the more you learn"
01-03-2014 09:11 AM
Carlo,
Thank you so much! I think it actually worked; it wasn't accepting anything else I was trying. It doesn't go into effect for a few weeks, but I'm crossing my fingers!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide