use DateTime; my $yyyy = 2015; my $mm = 05; my $date = DateTime->new(year => $yyyy, month => $mm); $date->subtract(days => ($date->day_of_week - 2) % 7 - 7 * 2); print "$yyyy年$mm月的第二個禮拜二是$date\n";
use Date::Manip::Base; my $dmb = new Date::Manip::Base; my $yyyy = 2015; my $mm = 5; my $ymd = $dmb->nth_day_of_week( $yyyy, 2, 2, $mm); printf "$yyyy年$mm月的第二個禮拜二是%s\n", join '-', @$ymd;
use Date::Manip::Date; my $date = new Date::Manip::Date; $date->parse('Second Tuesday in Jul 2015'); print $date->printf('%Y-%m-%d'); # prints 2015-07-14