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 } ####