On Mon, Dec 28, 2009 at 11:34 PM, Don Schwarz <[email protected]> wrote:
> The bug I referenced is definitely still present up to at least Java
> 1.6.0_10 .  I get "200901" when I run this code on my local Sun Java
> 1.6.0_10 JDK with a timezone of CST for 1262000152901L.
> The bug is that it's returning a value of "200901" instead of "201001" for
> time points that occur in 2009 but are in the "first week of 2010", which is
> defined as:
> "Week 1 for a year is the earliest seven day period starting
> on getFirstDayOfWeek() that contains at
> least getMinimalDaysInFirstWeek() days from that year."
> This blog post has a better description of the JRE bug:
> http://bmcardoso.blogspot.com/2008/01/javautilgregoriancalendar.html

Ah okay... now I got what you mean by the year bug. This is for sure
something I did not think about and what lead to my confusion. Thanks
for pointing that out. imho i do not think that it is really a bug; it
is simply too easy to be confused, a YEAR_OF_THE_WEEK would be cool as
stated by bmcardoso.


But still - one question remains: Why is the "ww" different in the US
(Don's machine and App Engine) (01) compared to Germany (53). Well. I
played around with the code, and one thing I forgot to set initially
was the Locale of the SimpleDateFormat(pattern, Locale). Setting it to
Locale.US returns week 01; setting it to Locale.GERMAN returns week
53. Bingo.

And the answer lies in the fact that getFirstDayOfWeek() is in
Locale.US sunday, in Locale.GERMAN monday. Together with the way how
week is calculated we have a different week depending if you are in
the US or in Europe. Still really strange.


Summing up: Not at all a bug in app engine, but I would never ever use
week in a critical international environment...


Thanks Don... that really helped me a lot :)

Raphael

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to