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.
Note
cultureCode (string): A culture code to apply to the string.
Format Codes for Numeric Values
Use these codes to format strings as numeric values.
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.
Pre-Defined Date Formats
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.
Description
Format String
Examples
Short date
d
(en_US) 8/5/2026
(fr_FR) 05/08/2026
(ja_JP) 2026/08/05
Long date
D
(en_US) Wednesday, August 5, 2026
(fr_FR) mercredi 5 août 2026
(ja_JP) 2026 年 8 月 5 日
Long date and short time
f
(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 time
F
(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 time
g
(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 time
G
(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 day
m or M
(en_US) August 5
(fr_FR) 5 août
(ja_JP) 8 月 5 日
Round-trip date and time
o 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 time
r 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 time
s
(en_US) 2026-08-05T13:45:30
(fr_FR) 2026-08-05T13:45:30
(ja_JP) 2026-08-05T13:45:30
Short time
t
(en_US) 1:45 PM
(fr_FR) 13:45
(ja_JP) 13:45
Long time
T
(en_US) 1:45:30 PM
(fr_FR) 13:45:30
(ja_JP) 13:45:30
Universal sortable date and time
u
(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 time
U
(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 year
y or Y
(en_US) August 2026
(fr_FR) août 2026
(ja_JP) 2026 年 8 月
Custom Date Formats
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.
Day and Date Format Strings
Description
Example
String (MC Engagement)
String (MC Next)
Full day name
Monday
dddd
EEEE
Abbreviated day name
Mon
ddd
EEE
Date (zero-padded)
05
dd
dd
Date (non-zero-padded)
5
d
d
Day number in week
1
(not available)
u
Month Format Strings
Description
Example
String (MC Engagement)
String (MC Next)
Full month name
August
MMMM
MMMMM
Abbreviated month name
Aug
MMM
MMM
Month number (zero-padded)
08
MM
MM
Month number (non-zero-padded)
8
M
M
Year Format Strings
Description
Example
String (MC Engagement)
String (MC Next)
Full year number
2026
yyyy
yyyy
Last two digits of year
26
yy
yy
Calendar era
AD
gg
G
Time Format Strings
Description
Example
String (MC Engagement)
String (MC Next)
Hour (24-hour, zero-padded)
13
HH
HH
Hour (24-hour, non-zero-padded)
13
H
H
Hour (12-hour, zero-padded)
01
hh
hh
Hour (12-hour, non-zero-padded)
1
h
h
Minute (zero-padded)
05
mm
mm
Minute (non-zero-padded)
5
m
m
Second (zero-padded)
09
ss
ss
Second (non-zero-padded)
9
s
s
Millisecond
423
fff
S
AM/PM marker (two letter)
PM
tt
a
AM/PM marker (first letter only)
P
t
(not available)
Time zone name
UTC
(not available)
z
Time zone offset (hours and minutes, zero-padded)
-0800
zzz
Z
Time zone offset (hours only, zero-padded)
-08
zz
X
Time zone offset (hours only, non-zero-padded)
-8
z
X
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)”).
1%%[2 Var @now, @dateString3 Set @now = "5 August 2026 1:41:23 PM"4 Set @dateString = Format(@now, "dddd, MMMM d yyy HH:mm:ss (zzz)", "Date", "en_US")5]%%6<p>Date and time with a custom format: %%=v(@dateString)=%%</p>
The function outputs the date and time using the format that you specified.
1Date and time with a custom format: Wednesday, August 5 2026 1:41:23 (-06:00)
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.
1%%[2 Var @now, @dateString3 Set @now = "5 August 2026 1:41:23 PM"4 Set @dateString = Format(@now, "ddddd, d MMMM yyyy", "date", "sw_KE")5]%%6<p>Date and time with a custom format: %%=v(@dateString)=%%</p>
The function outputs the date string with the appropriate values translated.
1Date and time with a custom format: Jumatano, 5 Agosti 2026
Formatting Currency Values
1%%[2 Var @cost, @finalCostInDollars3 Set @cost = "31.4159"4 Set @finalCostInDollars = Format(@cost,"C2")5]%%6<p>The total price is %%=v(@finalCostInDollars)=%%.</p>
The function outputs the string expressed as a dollar amount rounded to two decimal places.
1The total price is $31.42.
You can use the cultureCode parameter to express currency values for a different country. This example outputs the currency value in Indian Rupees.
1%%[2 Var @cost, @finalCostInRupees3 Set @cost = "3141.5926535"4 Set @finalCostInRupees = Format(@cost, "C0", "", "bn_IN")5]%%6<p>চূড়ান্ত মূল্য %%=v(@finalCostInRupees)=%%</p>
The function outputs the currency value expressed in Indian rupees, rounded to the nearest whole number.