This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I'm looking for a simple way to determine which Monday of the year today is ... Let me explain.
The application is using GregorianCalendar to get the week, but that puts 12/29/2008 as the 53rd week (actually, GregorianCalendar puts 12/29/2008 into the first week) and 1/7/2008 was in the second week even though it was the first Monday of the year. 1/5/2009 will also be in the second week. However, what I really want to know is that it is the first Monday of the year and 12/29/2008 is the 52nd Monday of 2008.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Chec out this thread which explains why this is week 1. If you play around with the first day of the week and the minimal numbers of days for the first week I'm sure you can find a solution. I'm guessing Monday and 7 would do it
I'm not sure we understand the requirements here. Now that it's Tuesday (for some of us), would your question be which Tuesday of the year is it? Or are you only interested in Mondays? If it's the former, you might try something like this:
That tells me that today is the 53rd Tuesday of the year.
Marilyn de Queiroz
Joined: Jul 22, 2000
I'm only interested in Mondays. Thanks for the helpful responses