Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Trouble with Dates

by poj (Priest)
on Jul 10, 2013 at 19:15 UTC ( #1043540=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Trouble with Dates
in thread Trouble with Dates

To get last day of previous month add -1 days to the 1st of the current month.

#perl use strict; use Date::Calc qw( Delta_Days Today Days_in_Month Add_Delta_Days); # add Add_Delta_Days my ($y,$m,$d) = Today(); # Add_Delta_Days #($year,$month,$day) = Add_Delta_Days($year,$month,$day,$Dd); my $prev_mth_end = sprintf "%04d,%02d,%02d", Add_Delta_Days($y,$m,1,-1); print $prev_mth_end;
All the function are documented in Date::Calc.
poj


Comment on Re^3: Trouble with Dates
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2015-07-30 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls