Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to get last month date period

by youlose (Scribe)
on Mar 04, 2010 at 18:32 UTC ( [id://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);

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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-28 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found