develooper Front page | perl.beginners | Postings from April 2002

Re: Backing up two days from localtime

Thread Previous | Thread Next
Michael Lamertz
April 26, 2002 07:08
Re: Backing up two days from localtime
Message ID:
On Fri, Apr 26, 2002 at 08:32:21AM -0400, Tara Calishain wrote:

> I'm anticipating coming across this same problem with user input dates, and
> I don't expect the seconds trick will work for that one.
> For example, say a user specified $day-$month-$year and ten days, and I
> wanted to generate a date string for every day going back ten days.

Although Randal L. Schwartz posted a hillarious comment on Date::Manip


you should take a look at that module.  I have used it quite a lot to
let people pass more or less generic time/date specifications to my
scripts.  It does for example things like that:

    ---------- snip ----------
    nijushiho:~# perl -MDate::Manip -le 'print UnixDate("44 days ago", "%Y%m%d")'
    ---------- snip ----------

It comes at a price though, so I wouldn't use it to process some 20 million
lines of webserver logs in a nightly run :-)

		       If we fail, we will lose the war.

Michael Lamertz                        |      +49 221 445420 / +49 171 6900 310
Nordstr. 49                            |             
50733 Cologne                          |       
Germany                                |      

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About