UCCX and Time Zones

Answered Question
Dec 9th, 2009

After searching and not finding any good examples, and the Time and Date steps not being aware of anything other than that which the server sits(Cisco developers...HINT HINT!!! that would be a nice feature), I put this together out of desperation.  This is the first time I have ever even thought attempting to write something in Java, so...."Pretty" took a back seat to functional.


However...does anyone have a better way of doing this?

Attachment: 
Correct Answer by Jonathan Schulenberg about 7 years 2 months ago

I was lazy and didn't bother loading your custom class to look at it. Instead I am sharing a subroutine [subflow] that I built. It is part of a larger application but you can reuse it easily enough.


It will return the current date, time, and day of week. If you pass a timezone it will also perform the proper adjustments - including DST rules - from the server's local time.


A few things to note:

  • JRE must be properly patched for the DST offset to be accurate. You can't apply JRE patches other than through CCX patches so you may need to patch your system.
  • The values returned are not parsed into Date- and Time-type variables. The date is returned as a literal string. The time is returned as both a String and an integer. The day of week is returned as an integer.
  • The timezone must be in a zoneinfo format. E.g. "America/Chicago"
  • This will only work with an Enhanced or Advanced CCX license or an IP IVR license.
  • This was written for CCX 7.0(1). Your ability to open it in lower version editors may vary, especially below 5.0.


Just to disclaim this up front: This code is provided as-is without warranty. Use at your own risk.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4.7 (3 ratings)
Loading.
Correct Answer
Jonathan Schulenberg Thu, 12/10/2009 - 04:59

I was lazy and didn't bother loading your custom class to look at it. Instead I am sharing a subroutine [subflow] that I built. It is part of a larger application but you can reuse it easily enough.


It will return the current date, time, and day of week. If you pass a timezone it will also perform the proper adjustments - including DST rules - from the server's local time.


A few things to note:

  • JRE must be properly patched for the DST offset to be accurate. You can't apply JRE patches other than through CCX patches so you may need to patch your system.
  • The values returned are not parsed into Date- and Time-type variables. The date is returned as a literal string. The time is returned as both a String and an integer. The day of week is returned as an integer.
  • The timezone must be in a zoneinfo format. E.g. "America/Chicago"
  • This will only work with an Enhanced or Advanced CCX license or an IP IVR license.
  • This was written for CCX 7.0(1). Your ability to open it in lower version editors may vary, especially below 5.0.


Just to disclaim this up front: This code is provided as-is without warranty. Use at your own risk.

jmorlan Thu, 12/10/2009 - 13:16

Thanks!  That helps big time.  Helps that I can see something working and not have to build custom classes.

karunakar454 Tue, 03/22/2016 - 07:36

I have a small doubt.


Let suppose we have 10 different location configured in UCCX with 10 different time zone. out of 10 site two sites has DLS and UCCX time has one of the 10 time zone.


1.If i configured a script with Time of the Day in local time zone( Not in UCCX time zone). Did this work based on Local time zone or UCCX time zone. if it is not working in UCCX Time zone, what we need to do to work in local time zone.

2.If time zone change due to DLS. How UCCX update time zone for the site.

Deepak Rawat Tue, 03/22/2016 - 08:09

1.If i configured a script with Time of the Day in local time zone( Not in UCCX time zone). Did this work based on Local time zone or UCCX time zone. if it is not working in UCCX Time zone, what we need to do to work in local time zone.

Answer: If you choose TimeZone as TZ[local] for TOD, then the time is taken from the server which is acting as Master. If the TimeZone is set as TZ[primary] then it will always use the Node 1(primary UCCX server) for the time.

2.If time zone change due to DLS. How UCCX update time zone for the site.

Answer: In an ideal situation, you do not need to worry about this on UCCX side since CM will act as a NTP source for CCX and once it has the correct time zone and offset appplied, the same will be rolled down to CCX as well automatically.

Regards

Deepak

karunakar454 Tue, 03/22/2016 - 08:38

Thank you Deepak. Could you please clarify below points as well.

1. If site time zone is different from local and primary time zone, How i need to configure Time of the day. For example Master time zone is GMT+1 and primary time zone is GMT+2 and the site time zone is  GMT+5. How i need to update in script.

2. I knew if the DLS changes, the Call Manager automatically update phone time zone. But how this will get reflect in Contact center script TOD.

Deepak Rawat Tue, 03/22/2016 - 08:40

You will need to calculate the offset yourself in this scenario and specify the same while configuring TOD in the script then. Taking your example only, if your opening hours are 8:00 AM as per the site TZ then you will need to specify 4:00 AM or 5:00 AM respectively if you choose localTZ or primaryTZ respectively.


Regards

Deepak

karunakar454 Tue, 03/22/2016 - 08:58

Thank you deepak, could you please update below question as well.

2. I knew if the DLS changes, the Call Manager automatically update phone time zone. But how this will get reflect in Contact center script TOD.


Deepak Rawat Tue, 03/22/2016 - 09:23

As long as the time on UCCX server is correct post DST change, you do not need to worry about the TOD in scripts. Sometime, you might need to do a Refresh All on the scripts and applications post the DST change if things are not working as expected but that again is not a definite requirement but more of a recommendation.

Regards

Deepak

karunakar454 Wed, 03/23/2016 - 04:39

I have seen some option for configuring time zone in script. If i select time zone in Time of Day(TOD) will this works.

Deepak Rawat Wed, 03/23/2016 - 04:47

Why do you think it will not work?? 

Also what we are discussing from Yesterday is only the TimeZone thing that you need to set while using TOD in the script so not sure why suddenly you have doubts. Configure it yourself and do testing and then come back if you have questions.


Regards

Deepak

joshw Wed, 03/10/2010 - 14:48

Thanks for the script!  This works perfect for my scenario.

cleong999 Thu, 06/03/2010 - 12:44

How would I go about using the new 'time' that's extracted from the sub_datetime.aef script?  I would like to compare it against a time-of-day step (which seems to always reference the server time instead.


My UCCX 7.0(1) is in EST.

I've installed the sub_datetime.aef script and modified the timezone with America/Denver for MST.

In my Main.aef script I've created a subflow step that references sub_datetime.aef and returns String variable currentTime in the format hhmmss.

I have a time-of-day step that's looking for 6AM ~ 6PM to proceed to a CSQ.



Many thanks in advance

Jonathan Schulenberg Thu, 06/03/2010 - 12:48

That data cannot be used within the pre-built steps, including Time of Day. You would need to do a manual evaluation using If steps or other Java logic.

cleong999 Thu, 06/03/2010 - 13:34

Thanks Jonathan,

That's exactly what I needed.  I'll setup a couple of IF statements that match against the returned currentTime variable.


Chris

Anthony Holloway Thu, 06/03/2010 - 13:56

I'm curious, how will you compare the current time against an int of 154907 (3:49:07 PM)?  t[now].getTime() gives you the datetime in epoch.  Just curious as to what your solution will be.


I think a nice enhancement to Jon's script, an excellent one too I will add, could be that it returns the date in a variable of type Date, and the time in a variable of type Time.  This way you can use standard method calls to compare against.


Here's a small snapshot of how using Date/Time methods could look:

Attachment: 
cleong999 Thu, 06/03/2010 - 14:17

Maybe I'm doing this incorrectly but I was going to remove the time-of-day step and insert an IF statement to the effect of:

If currentTimeInt (Int returned from Jonathan's script) >= 060000

then goto:

next IF statement: If currentTimeInt <= 180000

then goto: CSQ


Any guidance would be appreciated. i.e. can the two IF statements above be nested?


Thanks in advance,


Chris

cleong999 Thu, 06/03/2010 - 14:32

Sorry for changing the subject of this post, but here's what I ended up with (for those other noob who're struggling through):


Implimented Jonathan's sub_datetime.aef script.


In main.aef script created a subflow that referenced the sub_datetime.aef and pulled value of Int variable "currentTimeInt".


created a Day-of-Week step and broke out Weekdays and Weekends.


Under Weekdays, inserted the following IF statement:


If (currentTimeInt >= 060000 && currentTimeInt <= 180000) Then

True -> Goto CSQ-Step

False -> Goto ClosedPrompt


Thanks for all of the assistance.  If I could rate Jonathan's post higher, I would.


Cheers,

Chris

rore Mon, 09/12/2011 - 02:14

Hi There!


I have actually implemented this at a customer site and it works great!

But i bumped into a weakness in my solution that i wonder íf somebody can help out with!

For instance i compare if a queue shall be open or closed by doing an IF on the following logic


If (currentTimeInt >= 070000 && currentTimeInt <= 180000) Then

True -> Goto CSQ-Step

False -> Goto ClosedPrompt, that works ok

But if i want to compare


If (currentTimeInt >= 070000 && currentTimeInt <= 010000) and trying to do same logic it fails....

and in some cases my customer want to keep a queue open to 010000 AM due to extend their support opem hours!


The question is are there any built-in or function that can be used when do a compare on PM and AM times and then crossing dates. I

IF so this way you could have a fully controlled TOD/DayOfWeek where several application/scripts could use a common SQL DB for storing business hours, exceptions etc.


Somebody?!


Rgds Nils

Actions

This Discussion