The Date format in the questionnaire is set by default to be short form (e.g. 01/10/2021). However on some occasions, you might want to extract a specific element of the date. For example, the day, month or year.

In the example below, the specific month of February has been extracted from the answered date.

For added help feel free to watch this video:

  1. To start off, navigate to the Operations tab in your template. To start off, navigate to the Operations tab in your template. Then, click the blue + button.

2. A pop up menu will appear on the right. Rename your operation to your desired name and click "Rename operation".

3. To create the operation, click the "Add" button and select Date Format under Localisation, so that Date Format is in the top band.

4. Then click the word "Add" again and select the term Attribute. In the drop down list for the attribute, you can either select an existing Date attribute. Or, you can create a wholly new attribute.

5. Then, go back into the questionnaire and navigate to the relevant attribute. Click the drop down list to the right of the attribute and change the question type to Date.

6. Then, choose the element of the date that you wish to extract. This is inputted by selecting the text input and typing in the relevant date format code.

Date format codes

Year

Full year

%Y

2000, 2001, 2019

Short year with zero padding

%y

01, 02, 19

Short year without zero padding

%-y

1, 2, 19

Month

Full month name

%B

January, February, March

Abbreviated month name

%b

Jan, Feb, Mar

Month number with zero padding

%m

01, 02, 03

Month number without zero padding

%-m

1, 2, 3

Week

Week of the year (Monday as start of the week)

%W

00, 01, 02, …, 99

Week of the year (Sunday as start of the week)

%U

00, 01, 02, …, 99

Day

Day of the year with zero padding

%j

000, 001, 002, ..., 366

Day of the year without zero padding

%-j

0, 1, 2, …, 366

Day of the month with zero padding

%d

01, 02, …, 31

Day of the month without zero padding

%-d

1, 2, …, 31

Full weekday name

%A

Monday, Tuesday, Wednesday

Abbreviated weekday name

%a

Mon, Tue, Wed

Weekday as number

%w

1, 2, 3

7. After this, navigate back to the "Document" tab. Navigate to the Automation tab on the blue bar on the top and click the Operations icon. Select the relevant operation and click insert.

8. Your operation should now work! Click on the "Live Demo" to test it out by answering the relevant date question.

Did this answer your question?