Date Format Pattern Translator

One pattern, read by five formatters: UTS 35 (CLDR 48.2 week data), date-fns 4.x, moment 2.x, POSIX strftime and .NET custom format strings. See what each prints for your date and region, then get the same meaning written in each dialect, checked by a live round trip.

Pattern, date and rules

Try YYYY-MM-dd, %G-W%V-%u, gggg-[W]ww or dd MMM yyyy.
YYYY-MM-DD HH:mm:ss.SSS, years 1000 to 9999. No time zone is applied.
Two letters or a three-digit code. Territories in no list inherit 001 (Monday, minDays 1). Language tags are not accepted.
weekStartsOn / firstWeekContainsDate as set in that date-fns 4.4.0 locale. Names stay enUS. Default enUS is date-fns's fallback.
C / POSIX locale. glibc and MSVC extensions are marked where used.

View A: the same string, read by every dialect

The literal pattern above is tokenized by each formatter. Each chip shows the token, what it means in that dialect, and what it printed.

View B: the same meaning, written in each dialect

The source pattern is parsed into fields. Each field is written in every other dialect. A field with no equivalent is named, never dropped. The round trip renders source and translation with this page's engines on every day from 2020-01-01 to 2030-12-31, once at 12:00:00.000 and once with the time of day stepped through all 24 hours, and counts how many outputs match.

Translations of the source pattern
DialectPatternPrints nowRound tripNotes

Trap dates: where week-year is not calendar year

Computed for the rules picked above. Every day of that year whose week-based year differs from its calendar year is listed. Nothing here is a hardcoded list.

Self test

Runs on load and on demand. Fixtures were measured on real engines; oracles are recomputed here. A positive control must fail and be reported as detected.

    Reference notes

    Rules this page models, and where they come from

    Sources: UTS 35 Part 4 (Dates) and Part 1, version 48.2; CLDR release-48-2 supplementalData.xml and en.xml; POSIX.1-2024 strftime and the POSIX locale (XBD 7.3.5); the glibc manual, Formatting Calendar Time; Microsoft Learn pages for MSVC strftime and .NET custom and standard date and time format strings; the moment docs and its 2.30.1 source; the date-fns 4.4.0 package; Java SE 25 DateTimeFormatter and SimpleDateFormat; Apple's archived Data Formatting Guide. Every link is listed in the README.

    Third-party notices