Guest

Cisco Unified Contact Center Express

Obtain the Current Date When Writing a Cisco CRS Script

Cisco - Obtain the Current Date When Writing a Cisco CRS Script

Document ID: 48141

Updated: Apr 06, 2005

   Print

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:

  1. 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().

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

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

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

Figure 1 – Sample Script

qa-currentdate-1.gif

Note: The purpose of this sample script is to demonstrate how to obtain the current date.

Related Information

Updated: Apr 06, 2005
Document ID: 48141