Skip to main content

Hello , 

we have experienced strange behaviour of the system. Dates in the last week of the year were changed/forwarded on layouts by one year. When date in the system was 31.12.2020 it was printed as 31.12.2021. WQe have discovered that in used languages Short date format was set to “YYYY-MM-dd” when changed to “yyyy-MM-dd” dates are printed correctly. 

Can someone please provide explanation ? What is difference between YYYY-MM-dd and yyyy-MM-dd ? 

Thanks Martin 

Hi Martin,

 

YYYY returns the “year of the week”. Whereas yyyy just returns the specific “year of the date”.


In your example 31/12/2020,
“yyyy” denotes the year of the date, which is “2020”.
YYYY” denotes the year of the week. 31st of December 2020 is a Thursday but it falls in the 1st week of year 2021 as you can see below. Therefore YYYY returns 2021, which result in 31/12/2021.

 

 

Better to use date format ”yyyy-MM-dd” since it is logically correct for your purpose. Hope this is what you have asked.

 

Best Regards,

Anjaleen


Yes, Yes, Yes. That’s exactly what wanted to hear/read. I am so glad we have found what is behond the our issue. Thank You . You’ve made my day. Regards. Martin 


@llemartinhae,

I think there is something else wrong in your system. 2020 had 53 weeks:

 

Therefore yyyy and YYYY should return 2020.