in reply to compare dates

Best way to compare dates is probably to format them like YYYYMMDD. That way you can compare them numerically.

You can convert your date into this format like this:

$std_date = sprintf('%04d%02d%02d', (split m|/|, $date)[2, 1, 0]);

And I'm betting there's an Informix function that returns dates in a very similar format.

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
Re: Re: compare dates
by extremely (Priest) on Jan 15, 2001 at 01:59 UTC
    I just wanted to point out that YYYYMMDD is also safe if you goof and compare it string-wise. That also makes it a great format for mixed data like "Mark20010106" since you can do the whole sort without an unpack/split/regex pass or heavy-duty transforming. Sexy...

    --
    $you = new YOU;
    honk() if $you->love(perl)