The date, even in its short form, can vary across different countries. For example in the US, the short date format is (MM/DD/YYYY), as opposed to the UK format of (DD/MM/YYYY), which is the default in Avvoka.
Users can select from commonly used date formats directly within the "Date" question card, including options for English (UK), English (US), Spanish, Portuguese, and more.
However, users can also create more bespoke date formats using operations. For example if it is a dual language document that needs to have the same date displayed in different languages, if they want to display the same date in different formats throughout the document or if they want a very specific date format.
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. Once you have done that, add a second argument using Text:
In this case we will use the code for month number
%m
, the code for day number%d
and the code for the year number%Y
Note that a comprehensive list of date format codes can be found by going to page 54 of Avvoka's Operations Guide, here. Below you can see some of the commonly used date format codes:
| Common Date format codes |
|
Year |
|
|
Full year | %Y | 2000, 2001, 2019 |
Short year with zero padding | %y | 01, 02, 19 |
Month |
|
|
Full month name | %B | January, February, March |
Month number with zero padding | %m | 01, 02, 03 |
Day |
|
|
Day of the month with zero padding | %d | 01, 02, β¦, 31 |
Day of the month without zero padding | %-d | 1, 2, β¦, 31 |
Arrange these codes in your preferred order. Ensure that there is a β
/
β between each code.
6. The operation should look similar to the image below. The example below shows an operation for the US Date format (MM/DD/YYYY).
For other Date Formats, may want to add a locale (this will dictate the language used for your operation) if you skip this part it will default to English.
You can do this by adding a "Text" argument and adding the relevant locale, for example, the locale for English is "en_GB" (other commonly used ones include "es" for Spanish, "fr" for French, "de" for German and "pt" for Portuguese). If you want to see more locales, you can check our operations guide here.
7. Then go into the questionnaire and change the format of the question under the attribute Date to the Date question type.
8. 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.
9. Your operation should now work! Click on the "Live Demo" to test it out by answering the relevant date question.