use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d', time_zone=>'UTC', on_error=>'croak' ); my $dt = $strp->parse_datetime('2017-11-23'); my $is_thanksgiving = $dt->month==11 && $dt->dow==4 && $dt->weekday_of_month==4; #### sub thanksgiving { my $year = shift; my $dt = DateTime->new(year=>$year,month=>11,day=>1); $dt->add(days=>1) while $dt->dow!=4; $dt->add(weeks=>3); return $dt; }