Formatting dates with AMPscript

How AMPscript date formatting works, what it changes in your email output, how time zones and locales affect results, and when a plain or ISO date is the better choice.

What AMPscript date formatting does

AMPscript is the scripting language used in Salesforce Marketing Cloud emails, landing pages and messages. Formatting a date in AMPscript means taking a stored date value, such as a field from a data extension or the current system time, and rendering it as a string in a chosen pattern, like a spelled-out month or a numeric year-month-day form. The work happens on the server when the message is built, so recipients receive ordinary text.

Is AMPscript date formatting suitable for your use?

For personalized messages that show a date to a reader, such as an appointment, renewal or order date, formatting the value in AMPscript is usually the right choice. The main benefit is control: you decide the order of day, month and year, whether the month is spelled out, and whether a time appears. The decisive tradeoff is that the output is only as accurate as the source value and its time zone. A correctly formatted date that reflects the wrong time zone is still wrong, and that error is harder to notice because the result looks polished.

A plain or unformatted value is preferable when the date is consumed by a system rather than a person, when the source field already holds the exact text you want, or when you cannot confirm the time zone of the stored value. In machine-facing contexts such as URL parameters, calendar files or values passed to another platform, an unambiguous ISO-style pattern (year-month-day) is safer than a reader-friendly format.

What the transformation actually changes

AMPscript formatting changes the characters that appear in the rendered message. It does not change the stored value in the data extension, and it is not a visual effect. This distinguishes it from CSS styling, font choices or bidirectional display settings, which alter how existing characters look or are ordered on screen without changing the characters themselves. The word "format" in this context refers to the pattern of date components, not to typefaces or Unicode styled letters.

Because the output is generated text, the concerns that apply to reversed, mirrored or Unicode-substituted text largely do not apply here. There is no character reversal, so combining marks and multi-code-point emoji are not at risk of being split. The one related consideration is localized output: month and day names in some languages include accented letters, which are normal characters and should render in any client that displays the message's encoding correctly.

The main date functions

Function | Purpose | Practical note
FormatDate | Formats a date using a date pattern, an optional time pattern and an optional locale | Accepts named styles and custom patterns; the most common choice for reader-facing dates
Format | Formats a value using a pattern string, with a type such as Date and an optional locale | Useful for precise custom patterns, including ISO-style output
Now | Returns the current system date and time | Reflects the platform's system time zone, not the recipient's
DateAdd | Adds or subtracts a number of years, months, days, hours or minutes | Common for expiry and reminder dates
DateDiff | Returns the difference between two dates in a chosen unit | Useful for countdowns and age-of-record checks
DatePart | Extracts one component, such as the year or month | Handy for conditional content
DateParse | Converts a string into a date value | Helps when the source field is stored as text
SystemDateToLocalDate | Converts system time to the local time configured for the account or user | Check how local time is defined in your account before relying on it

Example patterns

The snippet below formats one date several ways. The expected outputs in the comments assume an input of March 4, 2026 at 2:05 PM and follow the standard meaning of each pattern token; they were not produced by a live send, so confirm them in a preview before relying on them.

%%[
SET @eventDate = AttributeValue("EventDate")

IF NOT Empty(@eventDate) THEN
  /* 03/04/2026 */
  SET @usNumeric = FormatDate(@eventDate, "MM/dd/yyyy")

  /* March 4, 2026 */
  SET @usLong = FormatDate(@eventDate, "MMMM d, yyyy")

  /* Wednesday, March 4, 2026 */
  SET @withDay = FormatDate(@eventDate, "dddd, MMMM d, yyyy")

  /* 2026-03-04 */
  SET @isoStyle = Format(@eventDate, "yyyy-MM-dd")

  /* 2:05 PM */
  SET @timeOnly = Format(@eventDate, "h:mm tt")
ENDIF
]%%

Your appointment is on %%=v(@withDay)=%% at %%=v(@timeOnly)=%%.

Pattern tokens are case-sensitive, and mixing them up is the most common source of wrong output:

  • MM is the two-digit month; mm is minutes.
  • MMMM is the full month name; MMM is the abbreviated name.
  • d is the day without a leading zero; dd adds one; dddd is the full weekday name.
  • yyyy is the four-digit year.
  • HH is the 24-hour clock; hh and h are the 12-hour clock.
  • tt adds the AM or PM designator, which is easy to forget when using a 12-hour pattern.

Guarding with an empty check, as in the example, matters because an empty or unparseable value passed to a date function can cause rendering to fail. Test with records that have missing and malformed dates, not just clean ones.

Time zones

Marketing Cloud system time is commonly documented as US Central Standard Time without a daylight saving adjustment, which means Now() can be an hour off from local Central time for part of the year and further off for recipients elsewhere. Dates stored in data extensions may be in system time, in UTC or in whatever zone the importing system used. Confirm the source zone for each field before formatting it, and convert explicitly when needed rather than assuming.

%%[
SET @systemNow = Now()
SET @localNow = SystemDateToLocalDate(@systemNow)
SET @display = FormatDate(@localNow, "MMMM d, yyyy", "h:mm tt")
]%%

If a time is shown to recipients across zones, either state the zone in the text or show only the date. A date without a time is far less likely to mislead than a time without a zone.

Locale and ambiguity

Numeric dates are read differently by region: 03/04/2026 means March 4 to most US readers and April 3 to many others. For audiences outside the US, or mixed audiences, a spelled-out month removes the ambiguity. Both FormatDate and Format accept a locale argument, such as en-US or fr-FR, which controls month and day names and the default ordering of named styles. Custom patterns still follow the order you write, so a US-style pattern with a French locale produces French month names in US order, which may look odd to French readers.

Will the result stay readable after copying or sharing?

Because AMPscript produces ordinary characters on the server, the formatted date copies and pastes as the same text a reader sees. There is no hidden styling or substitution to lose, and email search within a mail client treats it like any other text. Editing is a non-issue for recipients; for your team, the stored data remains unchanged, so reformatting later only requires changing the pattern.

Accessibility depends mostly on the pattern you choose. Spelled-out dates such as March 4, 2026 give screen readers and other assistive technology words to announce, while compact numeric forms may be read as separate numbers or interpreted using the listener's regional settings. This review did not test specific screen readers or email clients, so treat that as a general principle and check with the assistive tools your audience uses. When a date is critical, such as a deadline or legal effective date, a spelled-out month is the safer plain-text equivalent.

When to skip custom formatting

  • The value feeds another system, a URL or a calendar file: use an ISO-style year-month-day pattern.
  • The source field is already stored as the exact display text you need.
  • The time zone of the stored value is unknown: show the date only, or resolve the zone first.
  • The audience spans regions and you cannot localize per recipient: use a spelled-out month rather than a numeric pattern.

Gaps in this review

  • No live sends or previews were run; example outputs reflect standard pattern semantics and should be confirmed in your account.
  • The full list of named styles accepted by FormatDate was not verified here; check current platform documentation before using shorthand styles.
  • No specific email client or screen reader was tested, so behavior in a particular destination is unconfirmed.
  • How SystemDateToLocalDate determines local time depends on account and user settings that vary between organizations.