in reply to DateTime and hour 0
I can't replicate the problem here. How about simplifying the algorithm instead?
# Lets find n minutes before!
my $datetime=DateTime->new( year => 2005,
month => month_to_num($month),
day => $day,
hour => $hour,
minute => $minute,
second => 00 );
$datetime->subtract( minutes => $minutes_b4 );
return @MINBEFORE = (
num_to_month( $datetime->month ),