Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Logical expressions > Checking date/time responses
 
Checking date/time responses
UNICOM Intelligence Interviewer - Server stores date and time responses as a date and time string. The way to test dates and times is to extract the date or time component that you want to test as a numeric value, and then write an arithmetic expression to test that value.
There are a number of functions that work with dates and times; the ones you are most likely to use are as follows:
Function
Description
Day
The day in month (1 to 31)
Month
The month in year (1 to 12)
Year
The year
Hour
The hour (0 to 23)
Minute
The number of minutes (0 to 59)
For information about other date and time manipulation functions, see Date and time functions.
To test the value returned by these functions, use the following operators:
Operator
Description
=
Equal to
<>
Unequal to
<
Less than
<=
Less than or equal to
>
Greater than
>=
Greater than or equal to
In the following examples, assume that the answer to the performance question is 22 December 2004 2:30pm.
Day in month
To test the day part of a date, use the Day function which returns a value in the range 1 to 31. For example:
Day(performance) < 20
returns False, because the date is later than the 20th of the month.
Month in year
To test the month part of a date, use the Month function which returns a value in the range 1 to 12. For example:
Month(performance) > 6
returns True, because the performance date is later than month 6 (June).
Year
To test the year part of a date, use the Year function. For example:
Year(performance) = 2005
returns False, because the performance date is during 2004.
Hour in day
To test the hour part of a date, use the Hour function which returns a value in the range 0 to 23. If the time is entered in 12-hour format, times with a pm tag are converted to their 24-hour equivalents. For example:
Hour(performance) >= 12
returns True, because the performance time is in the afternoon.
Minute in hour
To test the minute part of a date, use the Minute function which returns a value in the range 0 to 59. For example:
Minute(performance) <> 30
returns False, because the performance time shows 30 minutes.
See also
Logical expressions