Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to substract date in perl?

by JayBonci (Curate)
on Feb 26, 2003 at 06:56 UTC ( [id://238679]=note: print w/replies, xml ) Need Help??


in reply to How to substract date in perl?

Date::Calc is really useful for this sort of item.
use strict; use Date::Calc qw(Add_Delta_Days); my (undef, undef, undef, $day, $month,$year) = localtime(); $year+=1900; $month+=1; ($year,$month,$day) = Add_Delta_Days($year,$month,$day, -3); print join("-", $year,$month,$day)
Using localtime() is a little bit easier (and more portable, if that matters) than calling date from the shell. Good luck.

    --jaybonci

Log In?
Username:
Password:

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

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

    No recent polls found