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

Re: How to subtract date by 1 day

by tcf03 (Deacon)
on Dec 13, 2007 at 10:47 UTC ( #656801=note: print w/replies, xml ) Need Help??


in reply to How to subtract date by 1 day

Using this example you should be able to format it any way you'd like. POSIX should be included in your distro, so you wont need to install a module.
#!/usr/bin/perl use strict; use warnings; use POSIX qw(strftime); my $today = time; my $yesterday = $today - 60 * 24 * 60; my $formatted = strftime "%m/%d/%Y", ( localtime($yesterday) ); print "yesterday = $formatted\n";

update
What zaxo said...

Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2022-05-22 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?