Desktop User Guides > 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 are 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 is accepted.
Example
The interviewing program displays the question followed by a box in which the respondent can type an answer of up to 20 characters:
Date question
This graphic is described in the surrounding text.
Formats for dates and times
Dates can be written using letters or numbers for the month, and / (slashmark) or – (hyphen or dash) 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–2023
ddmmmyyyy
31–Dec–2023
mm/dd/yy
12/31/23
yyyy/mm/dd
2023/12/31
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/23 is always 4 January 2023, never 1 April 2023.
Times can 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, make the specification unambiguous to anyone who reads the script. If you are unsure who else might read the script, 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. For example, if the interview language is set to en–US, respondents must enter dates in the US format (mm/dd/yy or equivalent). If the interview language is set to en–UK, respondents must enter dates in the British format (dd/mm/yy or equivalent).
Date and time ranges
Questions might define just dates, just times, or dates and times. If you specify a date range only, the interviewing program accepts any time on any date within that date range. If you specify a time range only, the interviewing program accepts any date as long as the time is within the given range. If you specify a time and a date, the interviewing program only accepts responses where both the time and the date are in the given range. When you specify a date and time, the date must be 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 can enter any time between 6 o'clock and 11 o'clock at night. These times can 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