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?
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.