aspose file tools*
The moose likes Beginning Java and the fly likes Number of weeks in a month Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Number of weeks in a month" Watch "Number of weeks in a month" New topic
Author

Number of weeks in a month

Paul Michael Serrano
Ranch Hand

Joined: Nov 22, 2004
Posts: 59
Good Day,

Is there a class in Java that could compute for the number of weeks in a specific month?

Paul
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Calendar.getActualMaximum(Calendar.WEEK_OF_MONTH).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

And if you don't like the assumptions (about what constitutes a week) built into the Calendar class, you would still use the Calendar class to do the calculations based on your actual requirements.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

You can tweak the week-definition, with two methods: setFirstDayOfWeek and setMinimalDaysInFirstWeek.
Paul Michael Serrano
Ranch Hand

Joined: Nov 22, 2004
Posts: 59
Thanks guys....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Number of weeks in a month
 
Similar Threads
Passed SCWCD 71%
Calander class - calc the num of months weeks and days
Number of weeks in a month
regarding date in javascript
Comparing dates...