Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Generate a report for every month for a year

by sundialsvc4 (Abbot)
on Jun 26, 2017 at 16:18 UTC ( #1193598=note: print w/replies, xml ) Need Help??


in reply to Generate a report for every month for a year

If Date::Calc doesn’t do the trick, daresay Date::Manip will.

The usual method is to take whatever date you have been given, break it into (month, day, year), then create a new date with 01 as the day to produce “the first day of the month.”   Now, any one of several date-calculation routines can make very short work of reliably subtracting “n months” from that value.

Want “the last day of the month?”   With these trusty date-calculators, it’s just as easy:   just “add one month,” then “subtract one day.”

  • Comment on Re: Generate a report for every month for a year

Replies are listed 'Best First'.
Re^2: Generate a report for every month for a year
by marto (Bishop) on Jun 26, 2017 at 21:15 UTC

      I really don’t think that a Perl example of this idea is necessary, given that it is exactly the sort of date-handling logic that is very routinely found in any Microsoft Excel spreadsheet on this planet.

        This isn't a excel forum. You didn't recommended excel. Stop recommend things that you don't understand.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1193598]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-12-14 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (408 votes). Check out past polls.

    Notices?