in reply to Re^2: Getting previous dates from the current date
in thread Getting previous dates from the current date
Rather than time(), I'd suggest using...
use Time::Local; my $time = timelocal(0, 0, 12, (localtime)[3, 4, 5]);
This'll make midday your starting point for calculations, which helps sidestep the whole daylight savings issue Smylers pointed out.
As an added bonus, Time::Local is also part of the core distribution, so you don't need to install anything via CPAN (which is good, as some of those other more fancy Date:: modules are mighty bloaty!).
--k.
|
---|
In Section
Seekers of Perl Wisdom