From: zilore mumba <[EMAIL PROTECTED]>
> After brouwsing a lot ofdocumentation I cannot find how to get
> yesterday's or tomorrow's date in Perl, like `date --date "-1 day"
> "+%Y%m%d"` in bash. Is this possible in Perl? 
>
> I am making date directories, like 20081203. If I add, I get a problem
> at the end/begining of the month, I get like 20081131 or 20081200. 
>
> Thanks for any assistance.
> Zilore

time() returns the number of seconds since some date. localtime() 
formats or returns the individual parts of a date and does so either 
for the current date&time or for some date in the format of the 
number of seconds since the same date as time(). So in this 
particular case (and if you do not mind summer/winter-time changes) 
all you have to do is to pass time()+dayload_of_seconds to 
localtime(). And since you do not use the hour and minute you do not 
mind summer/winter-time.

If you need something more complex have a look at the DateTime module 
(http://search.cpan.org/search?query=DateTime&mode=all)

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to