In Java date formatting, uppercase YYYY represents the week-based year, while lowercase yyyy represents the calendar year. Using YYYY can cause dates in late December to print as the following calendar year depending on the system locale, leading to silent end-of-year production bugs. I always recommend auditing date patterns for lowercase yyyy .
I see this exact bug hit production every single year around late December: an application suddenly starts printing dates from the future. You haven't accidentally built a time machine; you've just fallen into one of Java's most notorious date-formatting traps—the subtle difference between uppercase YYYY and lowercase yyyy .
What is the difference between YYYY and yyyy in Java date formatting?
In Java, lowercase yyyy formats the standard calendar year, whereas uppercase YYYY formats the week-based year (or week year).…