Your skill will accomplishwhat the force of many cannot PerlMonks

### Re: No: of weeks in a month

 on Sep 13, 2012 at 11:45 UTC ( #993469=note: print w/replies, xml ) Need Help??

in reply to No: of weeks in a month

The question you ask is ambiguous:   September 2013 begins on a Saturday and ends the following Sunday ... how many weeks, to you, is that?   You might say six, or you might say four.   Date-calculation routines are available in abundance on CPAN, but first you must nail-down the exact meaning of the question for you.   See for example Date::Calc, Date::Manip for the math heavy-lifting.

Replies are listed 'Best First'.
Re^2: No: of weeks in a month
by DrHyde (Prior) on Sep 13, 2012 at 12:58 UTC

Or you might say 30/7 == 4 and 2/7.

You might even say 5, if your definition of a week being in a month is that it begins in that month - those being the weeks beginning on the 2nd, 9th, 16th, 23rd and 30th.

Re^2: No: of weeks in a month
by daxim (Chaplain) on Sep 13, 2012 at 13:32 UTC
The question you ask is ambiguous
No, it isn't. We have a standard that defines what a week is.

But that ISO standard has no definition of what defines weeks per month.

A week is clearly defined but not how it relates to the entity of the month. I think it's safe to assume that the OP meant it to be the number of weeks that either fall completely within the month and those that are transected by the beginning and end of the month.

Create A New User
Node Status?
node history
Node Type: note [id://993469]
help
Chatterbox?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2018-05-26 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
World peace can best be achieved by:

Results (194 votes). Check out past polls.

Notices?