Format()

Formats a string, date, or number in a specified format.

Marketing Cloud Engagement ✅ Yes
Marketing Cloud Next ✅ Yes

This function became available in Marketing Cloud Next during the Summer ’26 release (API version 67.0).

The Format() function has four parameters:

  • input (datetime, number, or string): Required. The string to apply formatting rules to.

  • outputFormat (string): Required. A format string to apply to input.

  • dataFormat (string): The data format of the string. Possible values are Date and Number.

    For best results, always specify a value for dataFormat. If you don’t specify a value for dataFormat, the function tries to determine the type of the input data.

  • cultureCode (string): A culture code to apply to the string.

Use these codes to format strings as numeric values.

CodeOutput Format
CCurrency
DDecimal
EScientific notation
FFixed-point
GGeneral
NNumber
PPercent

You can also format strings as dates. See Pre-Defined Date Formats and Custom Date Formats.

You can use this function to format strings in several different ways. These examples show some of the ways that you can use this function.

The Format() function can format a date string into one of several predefined formats. To format a date using one of these formats, specify the format string for outputFormat and specify Date for dataFormat.

This table lists the formats that are available in both Marketing Cloud Engagement and Marketing Cloud Next. Because the output value can vary based on the locale, this table includes example values for the en_US, fr_FR, and ja_JP locales.

DescriptionFormat StringExamples
Short dated
  • (en_US) 8/5/2026
  • (fr_FR) 05/08/2026
  • (ja_JP) 2026/08/05
Long dateD
  • (en_US) Wednesday, August 5, 2026
  • (fr_FR) mercredi 5 août 2026
  • (ja_JP) 2026 年 8 月 5 日
Long date and short timef
  • (en_US) Wednesday, August 5, 2026 1:45 PM
  • (fr_FR) mercredi 5 août 2026 13:45
  • (ja_JP) 2026 年 8 月 5 日 13:45
Long date and long timeF
  • (en_US) Wednesday, August 5, 2026 1:45:30 PM
  • (fr_FR) mercredi 5 août 2026 13:45:30
  • (ja_JP) 2026 年 8 月 5 日 13:45:30
General date with short timeg
  • (en_US) 8/5/2026 1:45 PM
  • (fr_FR) 05/08/2026 13:45
  • (ja_JP) 2026/08/05 13:45
General date with long timeG
  • (en_US) 8/5/2026 1:45:30 PM
  • (fr_FR) 05/08/2026 13:45:30
  • (ja_JP) 2026/08/05 13:45:30
Month and daym or M
  • (en_US) August 5
  • (fr_FR) 5 août
  • (ja_JP) 8 月 5 日
Round-trip date and timeo or O
  • (en_US) 2026-08-05T13:45:30.1230000
  • (fr_FR) 2026-08-05T13:45:30.1230000
  • (ja_JP) 2026-08-05T13:45:30.1230000
RFC1123 date and timer or R
  • (en_US) Wed, 05 Aug 2026 13:45:30 GMT
  • (fr_FR) Wed, 05 Aug 2026 13:45:30 GMT
  • (ja_JP) Wed, 05 Aug 2026 13:45:30 GMT
Sortable date and times
  • (en_US) 2026-08-05T13:45:30
  • (fr_FR) 2026-08-05T13:45:30
  • (ja_JP) 2026-08-05T13:45:30
Short timet
  • (en_US) 1:45 PM
  • (fr_FR) 13:45
  • (ja_JP) 13:45
Long timeT
  • (en_US) 1:45:30 PM
  • (fr_FR) 13:45:30
  • (ja_JP) 13:45:30
Universal sortable date and timeu
  • (en_US) 2026-08-05 13:45:30Z
  • (fr_FR) 2026-08-05 13:45:30Z
  • (ja_JP) 2026-08-05 13:45:30Z
Universal full date and timeU
  • (en_US) Wednesday, August 5, 2026 1:45:30 PM
  • (fr_FR) mercredi 5 août 2026 13:45:30
  • (ja_JP) 2026 年 8 月 5 日 13:45:30
Month and yeary or Y
  • (en_US) August 2026
  • (fr_FR) août 2026
  • (ja_JP) 2026 年 8 月

You can format a date string using a custom format by passing a string that specifies the format. The strings that you use vary depending on whether you use Marketing Cloud Engagement or Marketing Cloud Next.

DescriptionExampleString (MC Engagement)String (MC Next)
Full day nameMondayddddEEEE
Abbreviated day nameMondddEEE
Date (zero-padded)05dddd
Date (non-zero-padded)5dd
Day number in week1(not available)u
DescriptionExampleString (MC Engagement)String (MC Next)
Full month nameAugustMMMMMMMMM
Abbreviated month nameAugMMMMMM
Month number (zero-padded)08MMMM
Month number (non-zero-padded)8MM
DescriptionExampleString (MC Engagement)String (MC Next)
Full year number2026yyyyyyyy
Last two digits of year26yyyy
Calendar eraADggG
DescriptionExampleString (MC Engagement)String (MC Next)
Hour (24-hour, zero-padded)13HHHH
Hour (24-hour, non-zero-padded)13HH
Hour (12-hour, zero-padded)01hhhh
Hour (12-hour, non-zero-padded)1hh
Minute (zero-padded)05mmmm
Minute (non-zero-padded)5mm
Second (zero-padded)09ssss
Second (non-zero-padded)9ss
Millisecond423fffS
AM/PM marker (two letter)PMtta
AM/PM marker (first letter only)Pt(not available)
Time zone nameUTC(not available)z
Time zone offset (hours and minutes, zero-padded)-0800zzzZ
Time zone offset (hours only, zero-padded)-08zzX
Time zone offset (hours only, non-zero-padded)-8zX

This example shows how to format the date to include the full name of the day (“dddd”), the full name of the month (“MMMM”), the date without a leading zero (“d”), and the year (“yyyy”). It also shows the time in 24-hour format, including hours, minutes, seconds, and UTC offset (“HH:mm:ss (zzz)”).

The function outputs the date and time using the format that you specified.

You can use the cultureCode parameter to express day and month names in other languages. This example outputs the date using day and month names in Swahili.

The function outputs the date string with the appropriate values translated.

The function outputs the string expressed as a dollar amount rounded to two decimal places.

You can use the cultureCode parameter to express currency values for a different country. This example outputs the currency value in Indian Rupees.

The function outputs the currency value expressed in Indian rupees, rounded to the nearest whole number.