Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: No: of weeks in a month

by Anonymous Monk
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.


Comment on Re: No: of weeks in a month
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993469]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-12-20 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (97 votes), past polls