Do you want to compare your dates in Perl or in SQL? You've received some good answers for comparing your dates in Perl. If you have a need to compare them in SQL, you would use Informix's string-to-date conversion and then compare the dates with the basic comparison operators.
I don't have experience with Informix; here's how it would look with DBI and Oracle, using TO_DATE to convert the string. This example looks for rows with a date_new column before 26/11/1987.
my $sth = $dbh->prepare(<<EndOfSQL);
SELECT id
FROM mytable
WHERE date_new < TO_DATE(?, 'DD/MM/YYYY')
EndOfSQL
$sth->execute('26/11/1987');
while (my @row = $sth->fetchrow_array()) {
print "@row\n";
}
I hope this is helpful; I would expect an Informix solution to look remarkably similar.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.