The date format switch (\@) displays Salesforce date fields in the format you choose in your Word templates. Use it to show dates in a clear format that suits your audience or business standards.
Syntax
{{Object.DateField \@ "Pattern"}}
The quotation marks around the pattern are optional: \@ "dd-MM-yyyy" and \@ dd-MM-yyyy both work.
Values
Pattern is a combination of date specifiers. Letter case matters: MM is the month and mm is minutes.
| Specifier | Effect | Example output |
|---|---|---|
dd | Day, with a leading zero | 03 |
d | Day, without a leading zero | 3 |
MM | Month as a number | 06 |
MMM | Short month name | Jun |
MMMM | Full month name | June |
yyyy | Year | 2025 |
Without a switch, the date appears in a default format (wrong date format).
Where to add it
Add \@ and the pattern after the field name inside the merge field in your Word template.
Example
Input: an account whose Created Date is 3 June 2025.
| Format | Syntax | Output |
|---|---|---|
| Day-month-year (European/international) | {{Account.CreatedDate \@ "dd-MM-yyyy"}} | 03-06-2025 |
| Month-day-year (US standard) | {{Account.CreatedDate \@ "MM-dd-yyyy"}} | 06-03-2025 |
| Day/month/year (EU style) | {{Account.CreatedDate \@ "dd/MM/yyyy"}} | 03/06/2025 |
| Month/day/year (US style) | {{Account.CreatedDate \@ "MM/dd/yyyy"}} | 06/03/2025 |
| Abbreviated month | {{Account.CreatedDate \@ "MMM dd, yyyy"}} | Jun 03, 2025 |
| Full month | {{Account.CreatedDate \@ "MMMM dd, yyyy"}} | June 03, 2025 |
| Full month, no leading zero | {{Account.CreatedDate \@ "MMMM d, yyyy"}} | June 3, 2025 |
Works in
Word (DOCX) templates: every example on this page is a Word template field.
Notes
- Some patterns, such as
"MMMM d, yyyy", don't add a leading zero to the day (3 instead of 03). This is standard Word formatting behavior. - To show times and AM/PM, see Time and AM/PM.
Common errors
- The minutes appear where the month should be (for example
03-47-2025). The pattern usesmm(minutes); useMMfor the month. See Dates, numbers or currency show the wrong format. - A date near midnight shows the day before or after. The field is a DateTime shown in another time zone. Use a Date field if you only need the date. See Dates, numbers or currency show the wrong format.
- The document shows the tag, or a blank, instead of the date. Retype the whole tag in one go, check the field's API name, and check the field has a value. See Merge fields are blank or show their tags.