Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Compare Date

by shotgunefx (Parson)
on Mar 05, 2002 at 11:59 UTC ( [id://149334]=note: print w/replies, xml ) Need Help??


in reply to Compare Date

Date modules are there for a reason IMHO. There's many subtle things to go wrong. If you wanted to avoid modules totally, maybe think about doing it with the output of localtime, but I wouldn't exactly suggest it.

-Lee

"To be civilized is to deny one's nature."

Replies are listed 'Best First'.
Re: Re: Compare Date
by Anonymous Monk on Mar 05, 2002 at 12:04 UTC
    ok, thanks Lee - any recommendations on a module to achieve this?
      Date::Calc is a good module. A search for Date on CPAN returns a lot of results. Another one that looks interesting is Class::Date (has relative date functions). I've never used that later but it's worth looking into.

      I think one thing you have to figure out right off the bat is how to handle messages that should be sent on dates that don't occur every month.

      -Lee

      "To be civilized is to deny one's nature."
      Update

      Date::Calc looks like it will do what you want.
      ($year,$month,$day) = Add_Delta_YMD($year,$month,$day, $Dy,$Dm,$Dd);
      From the docs...
      If the resulting date happens to fall on a day beyond the end of the resulting month, like the 31st of April or the 29th of February (in non-leap years), then the day is replaced by the last valid day of that month in that year (e.g., the 30th of April or 28th of February). BEWARE that this behaviour differs from that of previous versions of this module!
        Date::Calc is certainly a good module, but if you want an object-oriented approach you may want to investigate Date::Handler or Class::Date on CPAN. I've used Date::Handler and it seems to work pretty well.

        metadoktor

        "The doktor is in."

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2025-04-19 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.