Formatting Dates in DocumentsCorePack Templates

Sarah Coleman, 10 July 2019

Have you ever wondered how to change the format of a date that is merged into a DocumentsCorePack template?  There are plenty of formatting options at your fingertips - read on to learn how to go beyond the standard dd/MM/yyyy format.

After inserting a date merge field into your DocumentsCorePack document template, the easiest way to change the format of it is to select it (by clicking anywhere on the field) and open 'Field Properties'.

image

There are several standard formatting options that you can select from the Format picklist.

image

Once you've updated the format of a field, you will notice that an ovalue suffix is appended to the field name, e.g., <<duedate_ovalue>>

If the format you’re after isn't available in the list, you can create your own by directly typing in a combination of letters into the Format field.  For example, if you only want the year from your date to appear, enter 'yyyy'.  For the month and year to merge in (e.g., July 2019), type in MMMM yyyy. Helpfully, as you’re typing in the letter combinations into the format field, an example appears above it.

image

For the date to appear as ordinal text, e.g., 5th of July, 2019, you can insert a field code into the mix.  Here's how:

Step 1: Ctrl F9 to insert the field code.  A set of brackets will appear {}

Step 2: Inside the brackets type the equals sign '='

Step 3: Insert your field

Step 4: Type '\*Ordinal'.  Be careful to type this text after the merge field.  You may find it helpful to turn on design mode (located on the Developer tab) so it is easier to spot where to locate the text.  Here is the field displayed with Designer Mode turned on:

image

Compared with Designer Mode turned off:

image

Step 5: Change the format of the field to day only (Click on the field, select field properties, type 'space' then lowercase 'd')

image

Step 6: Type ‘of’ and then insert the date field one more time and change its format to MMMM, yyyy.

Here is what the combination of fields looks like on your template:

image

And voila, the merged date:

image

Dates can also be formatted as words.  For example, the date 5/07/2019 can display as 'five' using the cardinal text code (\*CardText) and 'fifth' using the ordinal text code (\*OrdText).  You'll need to limit the formatting to just the day (lowercase 'd') as in step 5 above for this to work.