in reply to How to generate a report for last month
and Date::Calcsub dayslastmonth { use Class::Date qw(date now); my $date = now; my $first = new Class::Date {year=>$date->year, month=>$date->month +, day=>1}; my $last = $first - '0-0-1'; return $last->day; }
Class::Date is more object-oriented, but both have similar functionality.sub dayslastmonth { use Date::Calc qw(Today Days_in_Month); my ($year, $month, $day) = Today(); return Days_in_Month($year,$month - 1); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to generate a report for last month
by buckaduck (Chaplain) on Jun 01, 2001 at 23:01 UTC |