Formatting dates

Docmosis allows you to control how dates and times are displayed in the finished document.

For example: the raw data may have a date like: 21-03-16.

Using the built-in function dateFormat the date can be formatted so that it looks like this: Monday - March 21, 2016.

It is best to view the TEMPLATE and OUTPUT files side-by-side to understand the formatting that has been applied.

Parameters for dateFormat

The function dateFormat has up to three parameters. 

All three parameters are used in the statement  dateFormat ( value [, outputFormat [, inputFormat] ]). The first parameter contains the date/time.

value is the Date/Time to be formatted

The other two are the format strings, enclosed in single quotes.

inputFormat used to tell Docmosis how to decode the value that is passed in
outputFormat used to tell Docmosis how to display the decoded value

Format strings

Here is an example of a format string: 'dd-MMMM-yyyy'.

If they are not provided - Docmosis will use the default settings.

Some characters in the string are standard:

dd for a two digit day
yyyy for a four digit year

Other combinations are not so obvious:

MM is the Month in numeric format
MMM is the Month abbreviated to the first three letters
MMMM is the Month as a full word
mm is for minutes
EEEE the day expressed as a word
EEE the day abbreviated to the first three letters
hh is for hours in 12 hour notation
HH is for hours in 24 hour notation
aa  is for AM/PM

You will find the complete list in the Template Guide.

Displaying the current date/time.

Docmosis has a built-in variable that can be used to insert the current date and time:

<<$nowUTC>>

Please refer to the FAQ: How can I insert the current date / time? for details on how to use it with the dateFormat function.

Feedback

Invalid Input

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam. Please also consider contacting support@docmosis.com if you need help with this article.

Sorry, this field will only accept letters and numbers, and not special characters, to limit spam.

Invalid Input