• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between Year and Week year in SimpleDateFormat's pattern

 
Nick Widelec
Ranch Hand
Posts: 226
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Directly from this API

"
y Year Year 1996; 96
Y Week year Year 2009; 09

"

I have tested those two keywords for creating patterns, and they produce the same result.
What do they mean by Week year in that context?


 
Henry Wong
author
Marshal
Pie
Posts: 21220
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nick Widelec wrote:Directly from this API

"
y Year Year 1996; 96
Y Week year Year 2009; 09

"

I have tested those two keywords for creating patterns, and they produce the same result.
What do they mean by Week year in that context?


A week year is a year where all the weeks in the year are whole weeks. This is specified by some standard (which I don't remember at the moment). Basically, this guarantees that a program working on a week's data will not transition between years. Unfortunately, this also means that the beginning of the year may not start on the first of January. What year a particular day belongs in depends on these rules, and of course, there are days where the year and the week year are different.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic