Tagged articles
5 articles
Page 1 of 1
Java Backend Technology
Java Backend Technology
Sep 26, 2023 · Backend Development

Why Does Using 'YYYY' in Java Date Formatting Show the Wrong Year?

A Java date‑formatting bug occurs when the week‑based year pattern 'YYYY' is used instead of the calendar year 'yyyy', causing dates near year‑end to display the next year, and this article explains the cause, demonstrates it with code, and shows how to avoid it.

BackendDate FormattingSimpleDateFormat
0 likes · 4 min read
Why Does Using 'YYYY' in Java Date Formatting Show the Wrong Year?
Top Architect
Top Architect
Dec 31, 2021 · Backend Development

Understanding the Difference Between yyyy and YYYY in Java Date Formatting

The article explains a subtle Java date‑formatting bug where using the week‑based year pattern (YYYY) can incorrectly display the next calendar year for dates at year‑end, demonstrates the issue with sample code, and clarifies why yyyy should be used for ordinary year representation.

BackendCalendarDate Formatting
0 likes · 5 min read
Understanding the Difference Between yyyy and YYYY in Java Date Formatting