Skip to main content
Solved

is "YYYY" the same as "yyyy"

  • December 14, 2021
  • 3 replies
  • 181 views

Forum|alt.badge.img+4

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 

Best answer by Anjaleen Davidson

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

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

3 replies

Forum|alt.badge.img+6

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


Forum|alt.badge.img+4
  • Author
  • Do Gooder (Customer)
  • 6 replies
  • December 15, 2021

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 


Forum|alt.badge.img+14
  • Hero (Partner)
  • 241 replies
  • December 15, 2021

@llemartinhae,

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

 

Therefore yyyy and YYYY should return 2020. 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings