A common things to do in a UCCX script is to present different option to callers based on the time they are calling. If it's after hours, they should be getting a closed message and the same goes for holidays. Creating a static script behavior that is based on the "time of day" and "day of week" general steps is one way to do that, but it requires script editing whenever there is a change and it requires a script per customer in multiple queue scenario.
Another option is to act based on a database or XML file query, both are valid but require deeper programming skills and premium licensing (for the SQL query option).
There is another option that I have recently used and would like to discuss here. With this option a date variable is defined in the script and compared to other variables (which are also parameters) and the script behavior is determined based on those comparisons. By using parameters, the open/closed hours can be controlled outside of the script from the CCX appadmin interface.
To further explain here is how this can be implemented in order to check for a weekend day and act differently if this is a weekend day.
First define a date variable and call it currentDayTime, make sure it is initialized as D[now] which means it will be set to the current CCX server system time.
This is how it will look in script editor:
Now define two integer variables and set them to be a parameter, those would be used to configure the weekend days. The variables are initialized in the script to 1 and 7 which correspond to Sunday and Saturday, but this can be adjusted to other days since it's a parameter.
The relevant lines in the script editor would look like the following:
In the uccx script use an IF condition to check if the current day is a weekend day and define what to do based on the comparison. Here is how the IF condition would look like:
The xxx.dow method in a date variable represent the day of week in a numeric value of 1 through 7. This IF can be nested to check for public holidays and more variables/parameters for additional functionality. In order to check for the current hour, use the xxx.hod method, which represent the hour of the day in 0 through 23 values.
Comment if you have questions and I'll be happy to explain.