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.
The moose likes Beginning Java and the fly likes Is today the 53rd Monday of 2008? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Is today the 53rd Monday of 2008?" Watch "Is today the 53rd Monday of 2008?" New topic
Author

Is today the 53rd Monday of 2008?

Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9048
    
  10
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
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

Actually for me, you posted this on Tuesday

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3018
    
  10
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
Sheriff

Joined: Jul 22, 2000
Posts: 9048
    
  10
I'm only interested in Mondays. Thanks for the helpful responses
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is today the 53rd Monday of 2008?