in reply to date comparing

Just a tip: if you have to compare dates and want to do it yourself, the general algorithm goes like this:

Since the parsing task might be non-trivial, I like the Date::Parse module from TimeDate, but there are other date parsing modules in CPAN, and a bunch of them do date comparisons, too.

Replies are listed 'Best First'.
Re: Re: date comparing
by demerphq (Chancellor) on Aug 06, 2002 at 08:59 UTC
    Actually what you say is correct for determining time elapsed between two dates, but not for simply determining if two dates are inorder (what "compare" normally means). If the dates are in ISO or DIN compliant format then they are readily compared using the eq operator.

    Just another reason for discarding outdated conventional date formats like dd/mm/yy or the even more bizarre mm/dd/yy.

    print POSIX::strftime("%Y%m%d%H%M%S",localtime);
    Sorry, I guess i'm in a pedantic mood this morning. :-)

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.