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

Re^2: How to get last month date period

by bart (Canon)
on Mar 04, 2010 at 16:51 UTC ( #826740=note: print w/replies, xml ) Need Help??


in reply to Re: How to get last month date period
in thread How to get last month date period

This will break in January.

As for leap years, the rule is:

  • Assume 28 days, except:
  • if the current year divisible by 4: 29 days, except
  • if the current year is divisible by 100: 28 days except:
  • if the current year is divisible by 400: 29 days
  • Comment on Re^2: How to get last month date period

Replies are listed 'Best First'.
Re^3: How to get last month date period
by almut (Canon) on Mar 04, 2010 at 16:56 UTC
    This will break in January.

    You're right.  To fix, just add:

    $curr_year-- if $curr_month eq "Jan";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2016-09-30 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (566 votes). Check out past polls.