in reply to Within A Date Time Range

From the "Perl Cookbook", recipe 3.2: Convert your dates to epoch seconds and see if current time is between them:
use Time::Local; my $time1 = timelocal($sec1, $min1, $hours1, $mday1, $mon1, $year1); my $time2 = timelocal($sec2, $min2, $hours2, $mday2, $mon2, $year2); my $now = localtime; if ( $now > $time1 && $now < $time2 ) { # do stuff if within range } else { # do stuff if not in range }