one more thing, shouldn't my $time = time; be
local $time = time; even though my is safer and faster, local can be used globally and called from within any subroutine? thank you, Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams Gunnar Hjalmarsson <[EMAIL PROTECTED]> 08/17/2004 01:46 PM To: [EMAIL PROTECTED] cc: Subject: Re: date calculations David Greenberg wrote: > [EMAIL PROTECTED] wrote: >> If I wanted to subtract 1 from a date on the 1st of any month >> what module will reflect the correct date? For example, system >> time is 09.01.04 and I want data from 08.31.04, I would have to >> subtract 1 day. Which module do I need to install? > > Date::Manip from CPAN Hmm.. Pretty disputable advice for such a trivial thing, don't you think? From the Date::Manip POD: "If you look in CPAN, you'll find that there are a number of Date and Time packages. Is Date::Manip the one you should be using? In my opinion, the answer is no most of the time. ... Date::Manip is written entirely in perl. It's the most powerful of the date modules. It's also the biggest and slowest." Personally I don't know which of all the date related modules that would fit best, but I'm sure other do. I for one wouldn't use any module: my $time = time; sub mydate { my $days = (shift or 0); my ($d, $m, $y) = (localtime($time - $days * 86400))[3..5]; sprintf '%02d.%02d.%02d', $m + 1, $d, $y % 100; } print 'Today: ', mydate(), "\n"; print 'Yesterday: ', mydate(1), "\n"; -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>