Format - 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.

Feedback

Invalid Input

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

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

Invalid Input

Related items