Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Getting previous dates from the current date

by Smylers (Pilgrim)
on Mar 29, 2005 at 17:01 UTC ( [id://443184]=note: print w/replies, xml ) Need Help??


in reply to Re: Getting previous dates from the current date
in thread Getting previous dates from the current date

DateTime is also very good.

I agree; the DateTime suite is excellent: it has a very well-thought-out interface, does pretty much anything that any of the other modules do, and correctly covers all the awkward corners of date- and time-handling that you don't want to think about.

This thread has a bunch of different responses, but none of them look to me anywhere near as simple as:

print DateTime->now->subtract(days => 7)->date

Update: And, after actually bothering to read the other suggestions (rather than just noticing how complicated they look), the hand-rolled ones (avoiding modules for the date arithmetic) all seem to be wrong as well. So that's another advantage of DateTime: it quietly gets correct things that you haven't even bothered to think about.

Smylers

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found