Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: get previous month in two digit number

by davido (Cardinal)
on Jul 19, 2013 at 04:28 UTC ( [id://1045247]=note: print w/replies, xml ) Need Help??


in reply to get previous month in two digit number

With DateTime, you can:

perl -MDateTime -E 'say DateTime->now->month' perl -MDateTime -E 'say DateTime->now->subtract(months=>1)->month'

The output (we're currently in July):

7 6

Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-24 12:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found