This is where i like to use Time::Piece (Time::Seconds contains useful constants)
use strict; use warnings; use Time::Piece; use Time::Seconds; my $date_from_db = some_magic_function(); my $one_hour_ago = localtime( shift( @_ ) || time ) - ONE_HOUR; my $db_date = Time::Piece->strptime( $date_from_db, '%Y-%m-%d %H:%M:%S +' ); if ($db_date >= $one_hour_ago) { # process }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Compare Dates
by jeffa
in thread Compare Dates
by bfdi533
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |