Formatting Merge Fields
Format dates, times, numbers, currency, and percentages in merge fields with the | spec syntax — plus the automatic formatting ZeroExport applies by field type.
ZeroExport formats merge values two ways: automatically, based on the field's type, and explicitly, when you add a format spec to the token.
The | spec syntax
Add a format directive after any date, time, or number token using a space, a pipe, and a space (|):
{{Opportunity.CloseDate | dd MMM yyyy}}
{{Opportunity.Amount | 0,0.00}}
{today | MMMM d, yyyy}
The spaces around the pipe are required. An inline spec always wins over the automatic and document-level defaults.
Dates
Date fields use SimpleDateFormat letter patterns:
| Pattern | Example output |
|---|---|
MM/dd/yyyy | 07/21/2026 |
dd/MM/yyyy | 21/07/2026 |
dd MMM yyyy | 21 Jul 2026 |
MMMM d, yyyy | July 21, 2026 |
EEE, MMM d | Tue, Jul 21 |
yyyy-MM-dd | 2026-07-21 |
Common letters: yyyy year, MM month number, MMM/MMMM month name, dd day, EEE/EEEE weekday.
Note: For plain Date fields (no time component) any time zone in the spec is ignored — the date is always rendered as stored, so it never shifts to the previous or next calendar day across time zones.
With no spec, a Date renders in the running user's locale (e.g. 7/21/2026 for en_US, 21/07/2026 for en_GB).
Date and time
Datetime fields accept a pattern, a time zone, or both. Separate a trailing IANA time zone from the pattern with , :
{{Case.CreatedDate | dd MMM yyyy h:mm a}}
{{Case.CreatedDate | HH:mm, Europe/London}}
{{Case.CreatedDate | America/New_York}}
{{Case.CreatedDate | MMM d, yyyy h:mm a, America/Chicago}}
| Pattern | Example output |
|---|---|
h:mm a | 2:45 PM |
HH:mm | 14:45 |
dd MMM yyyy h:mm a | 21 Jul 2026 2:45 PM |
When no time zone is given, the datetime is converted to the running user's time zone. With no spec at all, it renders in the user's locale and time zone.
Numbers
Numeric fields accept either a plain decimal-place count or a numeric pattern:
| Spec | Input | Output |
|---|---|---|
0 | 1234.5 | 1,235 |
2 | 1234.5 | 1,234.50 |
0,0.00 | 1234.5 | 1,234.50 |
#,##0.000 | 1234.5 | 1,234.500 |
Grouping and decimal separators follow the user's locale (1,234.50 vs 1.234,50). Trailing zeros are preserved to the requested number of places, and values are rounded half-up.
Percentages
End the spec with % to render a percentage:
| Spec | Output |
|---|---|
0% | 75% |
0.00% | 74.50% |
For a Percent field (Salesforce stores these as 0–100, e.g. Probability 75), the % sign is appended without re-scaling. For a plain decimal you want shown as a percentage (e.g. 0.745), the % spec multiplies by 100 → 74.5%.
Currency
Currency fields are formatted automatically — you do not need a spec. ZeroExport applies locale-aware grouping, forces two decimal places, and prepends (or, for some European currencies, appends) the currency symbol:
{{Opportunity.Amount}} → $12,000.00
In multi-currency orgs, the record's own CurrencyIsoCode is used, so the symbol matches the record's currency rather than the running user's default.
PDF-safe symbols: Some currency glyphs are missing from standard PDF fonts and would render as blank boxes, so ZeroExport substitutes an ASCII form — for example INR renders as
Rs., THB asTHB, and PLN asPLN. Widely-supported symbols ($,€,£,¥) are used as-is.
Automatic formatting by field type
Even without a spec, ZeroExport formats these field types for readable output:
| Field type | Rendered as |
|---|---|
| Checkbox / Boolean | [X] when true, [ ] when false |
| Multi-select picklist | Semicolons become commas: Red;Blue → Red, Blue |
| Address (compound) | Multi-line: street, then city, state postalCode, then country (blank parts omitted) |
| Geolocation | latitude, longitude |
| Date / Datetime | User's locale (and time zone for datetimes) |
| Number / Currency | Locale-aware grouping separators |
Document-level defaults
Beyond per-token specs, a template can define default formatting — a default date pattern, datetime pattern, time zone, and number of decimal places — applied to every merge field of that type. The resolution order is:
- Inline spec on the token (
{{... | spec}}) — highest priority - Document-level default for that field type
- Apex locale / user time zone — the built-in fallback
This lets you set, say, dd MMM yyyy once for the whole document and override only the specific tokens that need a different format.
See also
- Merge Field Syntax — data tokens and relationships
- System Variables —
{today},{now}, and org/user tokens