Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Getting previous dates from the current date

by Kanji (Parson)
on Mar 29, 2005 at 18:18 UTC ( #443216=note: print w/ replies, xml ) Need Help??


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.



Comment on Re^3: Getting previous dates from the current date
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://443216]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (19)
As of 2015-07-28 13:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (255 votes), past polls