JavaScript Intl.DateTimeFormat tokens.
Date.prototype.toLocaleString, Luxon DateTime.toLocaleString
Intl has no format strings at all: you pass an options object saying which fields you want and at what width, and the locale decides the order, separators and spelling — you never control placement. The numeric/2-digit pair is the padding control. AM/PM has no standalone option; it appears automatically when hour12 is true (dayPeriod is a different thing — 'in the morning', not 'AM'). There are simply no week-number, day-of-year, quarter or unix-timestamp fields.
| Token | Means | Example |
|---|---|---|
| year: "numeric" | Four-digit year | 2006 |
| year: "2-digit" | Two-digit year | 06 |
| month: "numeric" | Month number | 1 |
| month: "2-digit" | Month number, padded | 01 |
| month: "short" | Month name, abbreviated month: "narrow" gives a single letter (M). | Jan |
| month: "long" | Month name, full | January |
| day: "numeric" | Day of month | 2 |
| day: "2-digit" | Day of month, padded | 02 |
| weekday: "short" | Weekday, abbreviated weekday: "narrow" gives a single letter (T). | Mon |
| weekday: "long" | Weekday, full | Monday |
| hour: "numeric", hourCycle: "h23" | Hour, 24-hour clock hourCycle: "h24" counts 1–24 instead of 0–23; hour12: false also forces h23. | 15 |
| hour: "2-digit", hourCycle: "h23" | Hour, 24-hour clock, padded | 15 |
| hour: "numeric", hour12: true | Hour, 12-hour clock hour12 picks h11 or h12 per locale and overrides any hourCycle you set. | 3 |
| hour: "2-digit", hour12: true | Hour, 12-hour clock, padded Some locales override the numeric/2-digit choice for hours; check resolvedOptions(). | 03 |
| minute: "2-digit" | Minute, padded minute: "numeric" exists but many locales render it two-digit anyway. | 04 |
| second: "2-digit" | Second, padded second: "numeric" exists but many locales render it two-digit anyway. | 05 |
| fractionalSecondDigits: 3 | Fractional seconds Accepts 1–3 only; digits beyond three are truncated, never rounded to more. | 000 |
| timeZoneName: "longOffset" | UTC offset, extended Prints GMT-07:00, not bare -07:00 — the GMT prefix is not removable. shortOffset gives GMT-7. | -07:00 |
| timeZoneName: "short" | Time-zone name, short Falls back to an offset (GMT-7) where the locale has no abbreviation; "long", "shortGeneric" and "longGeneric" also exist. | MST |
| era: "short" | Era "long" gives Anno Domini, "narrow" gives A. | AD |
Examples render the reference instant, Mon, Jan 2 2006, 3:04:05 PM MST.
Literal text
There are no literals — Intl composes the whole string from the locale; to interleave your own text, use formatToParts and assemble the pieces yourself.
Verified against MDN — Intl.DateTimeFormat() constructor.