Professional > Interview scripting > Writing interview scripts > Questions and responses > Questions with date/time responses
 
Questions with date/time responses
When a question requires a date, a time, or a date and time as a response, use the following syntax.
Syntax
Qname "Text" date [[Range]];
Parameters
Qname
The question name.
Text
The question text.
Range
An optional date/time range specifying which dates and times will be accepted as responses. If you omit this parameter, any date and time between 0:00:00 on 1 January 100 and 23:59:59 on 31 December 9999 inclusive will be accepted.
Example
The interviewing program displays the question text followed by an input box in which the respondent may type an answer of up to 20 characters:
Date question
Formats for dates and times
The Interview Scripting Language is very flexible with regard to specifying dates and times. Dates can be written using letters or numbers for the month and / or – as the separator. Years can be entered using two or four digits. Here are some examples of the more common date formats:
Format
Example
ddmonthnameyyyy
31–December–2004
ddmmmyyyy
31–Dec–2004
mm/dd/yy
12/31/04
yyyy/mm/dd
2004/12/31
Note If you use the numeric date format and you enter the date as dd/mm/yy (European notation), the date is treated as if it were mm/dd/yy, so 01/04/05 is always 4 January 2005, never 1 April 2005.
Times may be specified in 12-hour format as hh:mmam or hh:mmpm, or in 24-hour format as hh:mm.
Whichever methods you use for writing dates and times, your main objective should be to make the specification unambiguous to anyone who reads the script. If you are unsure who else may read or edit your script, it may be advisable to use letters rather than numbers for months.
When respondents answer a date question, the way in which they must enter dates is determined by the locale/culture/language setting of the interview. If the interview language is set to en–US, then respondents must enter dates in the US format (mm/dd/yy or equivalent). If the interview language is set to en–UK, then respondents must enter dates in the British format (dd/mm/yy or equivalent).
Date and time ranges
Questions may define just dates, just times, or dates and times. If you specify a date range only, the interviewing program will accept any time on any date within that date range. If you specify a time range only, the interviewing program will accept any date as long as the time is within the given range. If you specify a time and a date, the interviewing program will only accept responses where both the time and the date are within the given range. When you specify a date and time, the date must come before the time and must be separated from it by a space.
You can specify date and time ranges in any of the following formats:
A range of values
date ["From".."To"];
For example:
Dob "Please enter your date of birth"date ["1-Jan-1906".."31-Dec-2006"];
Any date in the given range is acceptable as a response.
Here is an example that uses a time specification:
TimeBooked "What time was your table booked for?"
date ["06:00pm".."11:00pm"];
Respondents may enter any time between 6 o'clock and 11 o'clock at night. These times may be entered in 12-hour or 24-hour format.
Here is an example with dates and times:
ConsultantTime "And when was your appointment with the research consultant?"
date ["2-Jan-07 09:00am".."31-Jan-07 05:00pm"];
An open-ended range
date ["From"..];
or:
date [.."To"];
A start date with no end date has an implied end date of 31 December 9999; an end date with no start date has an implied start date of 1 January 100. For example:
ExpiryDate "When does your driver's license expire?"date ["31-Dec-2004".. ];
A list of single values or ranges
To specify a list of single dates and/or times or date/time ranges, type:
date ["Dt1", "Dt2"," ... "Dtn"];
where:
Dt1 to Dtn are single dates, single times, or date/time ranges.
For example:
TourTime "When would you like to take the special tour?"
date ["2-Jan-07 09:00am".."15-Jan-07 05:00pm",
"16-Jan-07 01:00pm".."31-Jan-07 07:00pm"];
Exclusive values
To exclude specific dates or times from a range, type:
date ["Range1"[, ..."Rangen"] ^Exclude];
where:
Range1 to Rangen define the overall valid date/time range for the question.
Exclude is a date, time or date/time range within the overall range specification that is not valid. To exclude more than one date, time, or range, enter each one separately, preceded by a ^ symbol and separated by commas.
For example:
CollectDate "When would you like to collect the documents?"
date ["1-Dec-07".."31-Mar-08",^"25-Dec-07".."26-Dec-07",
^"28-Mar-06"];
Although you can specify a date and time range, you cannot force respondents to enter a date and a time. If a respondent enters a date without a time, the interviewing program assumes that the respondent means the current time and will accept the response as long as the current time falls within the acceptable range for the question. Similarly with dates. If the respondent enters a time but no date, the interviewing program assumes the current date and accepts the response as long as the current date is within the valid range. All responses appear in the case data as a date and a time.
See also
Questions with categorical responses