Formatting
Format a DateTime with an intl pattern, plus two extras: do for the day of the month with its ordinal suffix (1st, 2nd, 1er, 2.) and [...] for literal text. Literal text in intl quotes ('at') works too.
Pattern formatting
DateTime.format and FlutterDateFormatter.format give the same result. A FlutterDateFormatter can be kept and reused for any number of dates.
LOADING…
⚙ TRY IT
⚡ OUTPUT
final date = DateTime(2026, 10, 7, 5, 30, 52);
date.format(pattern: 'do MMMM yyyy', locale: 'en');
// or keep one formatter and reuse it
final formatter = FlutterDateFormatter('do MMMM yyyy', 'en');
formatter.format(date);
Ordinal numbers
FlutterDateFormatter.ordinal and formatOrdinalNumber follow the rules of each locale.
LOADING…
⚡ OUTPUT
FlutterDateFormatter.ordinal(21, locale: 'en');
date.formatOrdinalNumber(locale: 'en'); // day of the month
Pattern cheat sheet
| Token | Meaning |
|---|---|
do | Day with ordinal suffix: 1st, 2nd (package extension) |
[text] | Literal text, e.g. [Today is] EEEE (package extension) |
'text' | Literal text, as in intl: dd/MM/yyyy 'at' HH:mm; '' is an apostrophe |
d / dd | Day of month: 5 / 05 |
E / EEEE | Weekday: Wed / Wednesday |
M / MM / MMM / MMMM | Month: 3 / 03 / Mar / March |
y / yy / yyyy | Year: 2025 / 25 / 2025 |
Q / QQQ / QQQQ | Quarter: 1 / Q1 / 1st quarter |
H / HH, h / hh | Hour 0-23, hour 1-12 |
m / mm, s / ss | Minutes, seconds |
a | AM/PM marker |
yMd, yMMMd, jm, Hm … | intl skeletons: locale-aware formats |
Regions are kept
format(pattern: 'yMd', locale: 'en_GB') gives 04/03/2025, while en_US gives 3/4/2025. Locale codes are case-insensitive and accept BCP-47 tags such as pt-BR.