Document ID: 48141
Questions
Introduction
How to obtain the current date when you write a CRS script?
NetPro Discussion Forums - Featured Conversations
Related Information
Introduction
This document discusses how to obtain the current date when you develop a script with the help of the Cisco Customer Response Solutions (CRS) Application Editor in a Cisco IP Contact Center (IPCC) Express Edition environment.
Refer to Cisco Technical Tips Conventions for more information on document conventions.
Note: Cisco recommends that you have basic knowledge of CRS scripting.
Q. How to obtain the current date when you write a CRS script?
A. Java objects can be used for date comparisons. However, to do this, it is necessary to obtain the current date. Here is the step-by-step procedure to obtain the current date:
Figure 1 – Sample Script
- Add a Create Java Object step (see Step 1 in Figure 1). The variable name is dateObject and data type is Date. The constructor is java.util.Date().
- Add an Execute Java Method step to get the current year (see Step 2 in Figure 1). The method is getYear(). The result is assigned to currentYear, which is an integer variable.
Note: The getYear(0) method returns a value, which is 1900 less than the calendar year. In order to correlate to the correct calendar year, 1900 should be added to the returned value. This step is not shown in the sample script.
- Add an Execute Java Method step to get the current month (see Step 3 in Figure 1). The method is getMonth(). The result is assigned to currentMonth, which is an integer variable.
Note: The getMonth(0) method returns 0-11 for month value. In order to correlate to 1-12 calendar month value, currentMonth is increased by 1.
- Add an Execute Java Method step to get the current date (see Step 4 in Figure 1). The method is getdate(). The result is assigned to currentDate which is an integer variable.
![]()
Note: The purpose of this sample script is to demonstrate how to obtain the current date.
NetPro Discussion Forums - Featured Conversations
| NetPro Discussion Forums - Featured Conversations for Customer Contact Software |
| IP Communications and Video: Contact Center |
Related Information
| Updated: Apr 06, 2005 | Document ID: 48141 |
