CLDR YYYY
ISO week-based year.
2006
at the reference instant, Mon, Jan 2 2006, 3:04:05 PM MST
The year that owns the ISO week — differs from the calendar year around New Year (Dec 29 2003 is ISO 2004-W01-1). CLDR capital Y. THE classic bug: writing YYYY where yyyy was meant corrupts dates only in the year's final days, so it ships and then fires in production every January.
| Language | Token | Caveat |
|---|---|---|
| C / POSIX strftime | %G | Pairs with %V; %g is its two-digit form. Using %Y next to %V is the classic New-Year bug. |
| CLDR / ICU pattern | Y | The locale week-based year, which equals the ISO week-year only in ISO-week locales. Writing YYYY where you meant yyyy is the classic silent New-Year bug. |
| Java DateTimeFormatter | YYYY | Week-based year, but localized like w — truly ISO only in ISO-week locales. Using it with plain dd/MM is the classic New-Year bug. |
| Moment.js format | GGGG | Pairs with W. Lowercase gggg is the locale week-year; GG is the two-digit form. |
| PHP date() | o | Same as Y except around New Year, when the ISO week belongs to the neighbouring year. |
| Python strftime | %G | Pairs with %V; using %Y next to %V is the classic New-Year bug. |
| Ruby strftime | %G | Pairs with %V; mixing %Y with %V is the classic New-Year bug. %g is its two-digit form. |
| Rust chrono | %G | Pairs with %V; mixing %Y with %V is the classic New-Year bug. %g is the two-digit form. |
Definition anchored to Unicode UTS #35 — Date Field Symbol Table.