use Date::Calc qw(:all);
sub _getCOB {
my $mon = 'JanFebMarAprMayJunJulAugSepOctNovDec';
my @date;
my ($year,$month,$day) = Add_Delta_Days(Today(),0);
my $dow = Day_of_Week($year,$month,$day);
#if($dow == 1) {
# @date = Add_Delta_Days(Today(), -3);
# }
#elsif ($dow == 7) {
# @date = Add_Delta_Days(Today(), -2);
# }
@date = Add_Delta_Days(Today(), -0);
my $date = $date[2] . '-' . substr($mon, $date[1]*3 - 3, 3) . '-' . $date[0];
return $date;
}
my $cob_date;
$cob_date = &_getCOB();
print $cob_date;
|