cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
1259
Views
5
Helpful
2
Replies

UCCX Scripting. Fetching today's Day of Week in Monday, Tuesday,... format

Hi Guys!

 

Does anyone have experience with UCCX scripting in getting today's day of week through Date[now] function? or any Java function may be? Basically, I would like to get today's day of week in Monday, Tuesday.... format

 

P.S. Not interested in Day of Week Function as there's some specific requirement.

 

Regards

Taha

2 REPLIES 2
Chris Deren
Hall of Fame Master

You can try:

 

//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);

 

as recommended in this post:

 

https://community.cisco.com/t5/contact-center/decision-based-on-week-of-the-month/td-p/2434262

I think the OP was asking, how to get today's day of week name.  E.g., If today is January 30, 2019, then I should know that it's Wednesday.

 

If I'm right in what they were asking about, then one would do this:

 

Variables
String[] weekday_names = new String[] {"", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
Date today = D[now]
String today_weekday_name = ""

Script Steps
Set today_weekday_name = weekday_names[today.dow]

Note: The weekday_names array has an empty element up front, this is just one way of solving the fact that array's are zero indexed and weekdays are 1 indexed.  E.g., Sunday is 1, not 0.

Create
Recognize Your Peers
Content for Community-Ad