Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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 (Archbishop) 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?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2018-07-21 00:18 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (442 votes). Check out past polls.