Build no longer use ‘week yr’: YYYY
Advertisement

Build no longer use week yr YYYY and as a change use yyyy.

The Y refers again to the ‘Week yr’: https://doctors.oracle.com/javase/8/doctors/api/java/textual state/SimpleDateFormat.html

Every week yr is in sync with a WEEK_OF_YEAR cycle. All weeks between the first and final weeks (inclusive) maintain the same week yr cost. Therefore, the first and final days of per week yr can maintain various calendar yr values.

For instance, January 1, 1998 is a Thursday. If getFirstDayOfWeek() is MONDAY and getMinimalDaysInFirstWeek() is 4 (ISO 8601 fashioned appropriate environment), then week 1 of 1998 begins on December 29, 1997, and ends on January 4, 1998. The week yr is 1998 for the final three days of calendar yr 1997. If, on the opposite hand, getFirstDayOfWeek() is SUNDAY, then week 1 of 1998 begins on January 4, 1998, and ends on January 10, 1998; the first three days of 1998 then are portion of week 53 of 1997 and their week yr is 1997.

https://doctors.oracle.com/javase/8/doctors/api/java/util/GregorianCalendar.html#week_year

So since we were using Y for ‘Week yr’ the outdated couple of days of 2021 were logged as 2022, and Jan 1st 2022 used to be even logged as 2023.

Thanks for @easbar for helping me to search out this “characteristic” and repair an grotesque bother in production 😀

Advertisement

Be a part of the pack! Be a part of 8000+ others registered customers, and win chat, assemble groups, put up updates and assemble mates across the field!
www.knowasiak.com/register/

Advertisement

2 Comments

  1. I understand that "week year" is basically a payroll creation, but I am a bit concerned about the last few days of 2021 were logged as 2022, and Jan 1st 2022 was even logged as 2023.

    How the heck is Jan 1st 2022 put in the 2023 year?