Command Reference CIB jsMerge

Functions

formatDate(formatString, date)

The function “formatDate(formatString, date)“ returns the formatting of “date” as defined in „formatString“.

The following variants of “date“ are supported:


deDate() Function expects the date in this formatting
"dd.MM.yyyy" (dd and MM can be typed without a leading 0) or
"dd.MM." (if so the current year is added).
If there are errors in the string (e.g. missing the decimal points, no number, not a valid date like 30.2.12) there is a JavaScript Exception.
new Date()

Function returns the current date and the current time in this order: Year, month, day, hour, minute, second, millisecond.

Currently the follow formats are supported in "formatString":
"t", "d", "tt", "dd", "MM", "M", "jjjj", "yyyy", "jj", "yy", "HH", "H", "mm", "m", "ss", "s"


Examples:

{# text(formatDate(“jjjj”,deDate(“28.08.2012”)))}

Outputs „2012“ to the resulting document

{# text(formatDate(“tt.MM.jj”, new Date()))}

Outputs the current date to the resulting document using the specified formatting:"01.09.14"

{# text(formatDate(“jjjj”, enDate(“2012.08.10”)))}

Outputs „2012“ to the resulting document