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

 

The function formatDate has up to three parameters:

dateFormat ( value [, outputFormat [, inputFormat] ])

The value is the Date/Time to be formatted.

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

The format strings are used to tell Docmosis

1) inputFormat - How to decode the value that is passed in.

2) outputFormat - How to display the value once it is decoded.

 

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

The format strings are optional.  If they are not provided - Docmosis will use the default settings.

 

Some characters in the string are obvious:

dd - for a two digit day

yyyy - for a four digit year.

 

Other combinations are not so obvious:

MM - is the Month in numeric form.

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 Docmosis 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

Applies To

Docmosis-Java Tornado Cloud
Version(s) 4.0.3, 4.1.0, 4.2.0, 4.3.0, 4.3.1, 4.4.0, 4.4.1, 4.4.2 (Latest) 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.7.1, 2.7.2, 2.7.3 (Latest) ALL

Related items