Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: How to get last month date period

by youlose (Scribe)
on Mar 04, 2010 at 18:32 UTC ( #826777=note: print w/ replies, xml ) Need Help??

in reply to How to get last month date period

use DateTime;
use Modern::Perl;
my $fdm = DateTime->now->subtract(months=>1)->truncate(to=>'month');
my $ldm = DateTime->last_day_of_month(year=>$fdm->year,month=>$fdm->month);
my $stf_pat = '%d %b %Y';
say $fdm->strftime($stf_pat),' - ',$ldm->strftime($stf_pat);

Comment on Re: How to get last month date period
Replies are listed 'Best First'.
Re^2: How to get last month date period
by kivilahtio (Initiate) on Dec 22, 2014 at 09:51 UTC
    Sweet! A beautiful solution.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2015-11-25 09:17 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls