DATEPART
What Is It?
The Datepart Action Command enables the automatic capture of specific information based on a date variable. The date variable may be directly captured within the survey (for example, asking the respondent for their date of birth), or it may be the system variable that captures the date and time at the commencement of the survey (this variable is called SurveyEntryStartDateTime).
Available for: Single, Verbatim, and Verbatims questions.
How Do I Specify It?
- Right mouse-click on the target variable in the Designer Pane
- Select Action Command from the Quick Menu
- Select DATEPART from the drop-down list
- Enter the variable to be inserted, prefaced with an "@" (as shown below)
- Click "OK" to close the dialogue box.
Examples of Use
Target Variable | Datepart | Explanation |
Verbatim | MONTHNAME,@SurveyEntryStartDateTime | Inputs the name of the month from the survey start date |
DATEPART Command Options
Command | Example Result* | Explanation |
WEEKDAY,@SurveyEntryStartDateTime | Tuesday | Survey was started on a Tuesday |
DAY,@SurveyEntryStartDateTime | 15 | Survey was started on the 15th |
MONTH,@SurveyEntryStartDateTime | 03 | Survey was started on the third month |
MONTHNAME,@SurveyEntryStartDateTime | March | Survey was started in March |
MONTHNAME_SHORT,@SurveyEntryStartDateTime | Mar | Survey was started in March |
YEAR,@SurveyEntryStartDateTime | 2016 | Survey was started in 2016 |
YEAR_SHORT,@SurveyEntryStartDateTime | 16 | Survey was started in 2016 |
TIMEOFDAY,@SurveyEntryStartDateTime | afternoon | Survey was started after midday, and before 6pm |
HOUR,@SurveyEntryStartDateTime | 01 | Survey was started after 1 o’clock (and before 2) |
HOUR24,@SurveyEntryStartDateTime | 13 | Survey was started after 1pm (and before 2pm) |
AGE,@DOB | 43 | Respondent is 43 years of age |
*Where @SurveyEntryStartDateTime = Mar 15 2016 1:28PM