ui::DateFormatSymbols¶
Header: winui/core/DateFormat.hpp.
The names and patterns a locale writes dates and times with, as the date and time controls use them. The defaults are the locale-independent ones: English names, Sunday first and US patterns.
A pattern uses the Windows date and time pattern letters, the way the Region settings write them:
dandddare the day,ddwith a leading zero.dddandddddare the abbreviated and the full day name.MandMMare the month number,MMwith a leading zero.MMMandMMMMare the abbreviated and the full month name.yandyyare the last two digits of the year,ywithout a leading zero.yyyyis the full year.handhhare the hour on a 12-hour clock,HandHHon a 24-hour clock, doubled with a leading zero.mandmmare the minute.tis the first letter of the AM or PM designator,ttthe whole designator.'text'is written as it stands, and''is one apostrophe.
Every other character is written as it is.
Example:
// A delivery date in German, written the same whatever the user's own locale is.
ui::DateFormatSymbols german = ui::DateFormatSymbols::invariant();
german.month_names = {"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August",
"September", "Oktober", "November", "Dezember"};
const std::chrono::year_month_day day{std::chrono::year{2026}, std::chrono::October, std::chrono::day{19}};
window.set_content(ui::Text{.text = "Lieferung am " + ui::format_date(day, "d. MMMM yyyy", german)}); // "19. Oktober 2026"
month_names¶
std::array<std::string, 12> month_names {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
The month names, January first.
abbreviated_month_names¶
std::array<std::string, 12> abbreviated_month_names {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
The abbreviated month names, January first.
day_names¶
std::array<std::string, 7> day_names {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
The day names, Sunday first (the index is std::chrono::weekday::c_encoding()).
abbreviated_day_names¶
The abbreviated day names, Sunday first.
shortest_day_names¶
The shortest day names, Sunday first: a calendar's column headers.
first_day_of_week¶
The day a week starts on, the first column of a calendar.
short_date_pattern¶
The short date: "M/d/yyyy" (en-US), "dd.MM.yyyy" (de-DE), "yyyy-MM-dd" (sv-SE).
long_date_pattern¶
The long date: "dddd, MMMM d, yyyy" (en-US), "dddd, d. MMMM yyyy" (de-DE).
year_month_pattern¶
A month with its year, a calendar's heading: "MMMM yyyy" (en-US).
short_time_pattern¶
The short time: "h:mm tt" (en-US), "HH:mm" (de-DE).
am_designator¶
The designators a 12-hour time carries: "AM" and "PM" (en-US), "vorm." and "nachm." (de-AT).
pm_designator¶
See am_designator.
twelve_hour_clock¶
Whether short_time_pattern uses the 12-hour clock (an h outside quotes).
invariant¶
The locale-independent symbols, the default.