Format(value, format) Last updated: 03. Jan 2023

Formats a number or date into a string by given format.

Parameters

Name Type Description
value object Vale to format into a string.
format string Format string to format the value to:

For date fields:
https://developers.docly.net/JavaScript/Date-and-time-functions/Formatting-dates

For number objects:
https://developers.docly.net/JavaScript/Output-functions/Formatting-numbers

Returns

Value in specified format as string.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    var dt = new Date();
    write(format(dt, "dd. MMM yyyy"));
}#

Output

The #JS code above produces the output shown below:
25. Apr 2024