localtime() returns an array with populated with the details about the
current time and date (unless you feed it a date in Perl time() format).

The key, then is to get your text date into Perl time format.  Some
modules that can help you are Date::Manip, Date::Calc, and Time::Local.
I prefer the last one because it is simpler than the first two (they
handle a lot of things you don't need just for this).  Once you get your
date in Perl time, you can just subtract the requisite number of seconds
to get the date you want.

Of course, if you just want 72 days from right now, it's even easier:

my $dateInThePast = time - 72 * 86400;

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 05, 2005 9:10 AM
To: Rafael Morales
Cc: beginners@perl.org
Subject: Re: Dates again.

I am assuming that localtime() returns the time in unix file format
(number of
seconds since 12:00 AM on January 01, 1970). Why don't you convert 72
days to
seconds and subtract that number from the output of localtime()? 

For example, 72 days = 72 x 3600 x 24 seconds = 6220800 seconds

<snip>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to