With the Java Date formatter "YYYY" and "yyyy" have a very slight difference.
YYYY will give you the year belonging to the current week (whatever that means and is useful for). So sometimes around the end of the year things break.
So, the 31st of December 2020. That week technically belongs to the year 2021, so YYYY was returning 31st of December 2021 from our API while the database was correctly storing it as 31st of December 2020.
I'm a Systems Reliability and DevOps engineer for Netdata Inc. When not working, I enjoy studying linguistics and history, playing video games, and cooking all kinds of international cuisine.
The 'YYYY' format is for week number dates (today is 2020-W32-5 per the ISO 8601 week date system). Week number dates are used a lot in manufacturing (or at least, the year and week number is, not the weekday as much) because that makes it easier to trace a given batch of products to a particular shift that was responsible for producing or checking them.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
With the Java Date formatter "YYYY" and "yyyy" have a very slight difference.
YYYY will give you the year belonging to the current week (whatever that means and is useful for). So sometimes around the end of the year things break.
So, the 31st of December 2020. That week technically belongs to the year 2021, so YYYY was returning 31st of December 2021 from our API while the database was correctly storing it as 31st of December 2020.
ALWAYS use 'yyyy'
The 'YYYY' format is for week number dates (today is 2020-W32-5 per the ISO 8601 week date system). Week number dates are used a lot in manufacturing (or at least, the year and week number is, not the weekday as much) because that makes it easier to trace a given batch of products to a particular shift that was responsible for producing or checking them.