Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Possible bug in SimpleDateFormat??

807606May 8 2007 — edited May 8 2007
I just noticed a possible issue with formatting weeks in year. If I try to format a date ("12/31/06") to "yyyy-ww" format, I get "2006-01", which is totally unexpected. It looks like the week is limited to a value of 1-52. Even with that, it should consider it as "2007-01". This is not good, since this is often used for SQL querying and most DB's use the 01-53 week range. Has anyone seen this? Can you duplicate it?

Here's my code:
			
private static final SimpleDateFormat wkYrFmt = new SimpleDateFormat("yyyy-ww");
private static final SimpleDateFormat monDayYrFmt = new SimpleDateFormat("MM-dd-yy");
System.out.println(wkYrFmt.format(monDayYrFmt.parse("12-31-06")));
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 5 2007
Added on May 8 2007
13 comments
1,023 views