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

Re: How to substract date in perl?

by JayBonci (Curate)
on Feb 26, 2003 at 06:56 UTC ( #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? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2023-01-30 12:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?