Runtime verified Differs from official docs Test scripts included

Formats a value with a format string and, if given, a type.

Syntax

{{format subject formatString [type] [culture]}}

Returns string.

Parameters

Name Type Required Description
subject any Yes Input value.
formatString string Yes Pattern that shapes the output.
type string No Format type: date or numeric.
culture string No Culture code, such as en-US.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{format 1234.567 "N2;N0;N2"}} renders 1,234.57, as documented.
  • {{format -1234.567 "N2;(F2);N0"}} renders -1,234.57. The documented result is (1,234.57).
  • {{format 123 "000000"}} renders 123. The documented result is 000123.
Show Next test script
<!-- Marketing Cloud Next test script for the format helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[1,234.57] got=[{{format 1234.567 "N2;N0;N2"}}]</p>
<p>c2 expect=[-1,234.57] got=[{{format -1234.567 "N2;(F2);N0"}}]</p>
<p>c3 expect=[123] got=[{{format 123 "000000"}}]</p>

Differs from official docs

  • The reference says a format string may be split by ; into one section each for numbers above, below and equal to zero, and its own example formats -1234.567 with "N2;(F2);N0" as (1,234.57). In Marketing Cloud Next (tested 2026-11-22): {{format -1234.567 "N2;(F2);N0"}} rendered -1,234.57: the first section was used and the negative section ignored. The positive case, {{format 1234.567 "N2;N0;N2"}}, rendered 1,234.57 as documented. Details
  • The reference lists the custom format 000000 as padding 123 with leading zeros to 000123. In Marketing Cloud Next (tested 2026-11-22): {{format 123 "000000"}} rendered 123, without the leading zeros. Details

Marketing Cloud Next

See also