Docly Developers
Function Updated 23 Oct 2026

format(value, format)

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

Parameters

valueobjectrequired

Value to format into a string.

formatstringrequired

Format string to format the value to:

For date fields:
/JavaScript/Date and time functions/Formatting dates

For number objects:
/JavaScript/Output functions/Formatting numbers

Returns

Value in specified format as string.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    var dt = new Date();
    write(docly.format(dt, "dd. MMM yyyy"));
}#