Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: How to subtract date by 1 day

by ikegami (Patriarch)
on Dec 13, 2007 at 15:08 UTC ( [id://656836]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use POSIX       qw( strftime );
    use Time::Local qw( timegm );
    ...
    print(strftime("%Y_%m_%d\n", 
       gmtime(timegm(0,0,0,$d,$m,$y) - 24*60*60)
    ));
    
  2. or download this
    use POSIX       qw( strftime );
    use Time::Local qw( timegm );
    ...
    ($d,$m,$y) = (gmtime(timegm(0,0,0,$d,$m,$y) - 24*60*60))[3,4,5];
    
    print(strftime("%Y_%m_%d_%H_%M_%S\n", $sec,$min,$hour,$d,$m,$y));
    

Log In?
Username:
Password:

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

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

    No recent polls found