Hello Paul, Yes you can drop the second 2.
There are many ways to do this.
#!/perl/bin/perl
use strict;
# The array months with starting zero padding
my @Months = qw(ZERO Jan Feb Mar Apr May Jun Jul Aug Sept Nov Dec);
# Test date
my $date = "2003-04-26"; # April 26 2003
if ($date =~ /^\d\d(\d\d)-(\d\d)-(\d\d)$/) {
my $NewFormat = "$Months[$2]-$3-$1";
print " New Format : $NewFormat ( Month-DD-YY )\n";
}
else {
print "Ooops date in not in YYYY-MM-DD format \n";
}
Thanks
Cornball
There are many ways to do this.
#!/perl/bin/perl
use strict;
# The array months with starting zero padding
my @Months = qw(ZERO Jan Feb Mar Apr May Jun Jul Aug Sept Nov Dec);
# Test date
my $date = "2003-04-26"; # April 26 2003
if ($date =~ /^\d\d(\d\d)-(\d\d)-(\d\d)$/) {
my $NewFormat = "$Months[$2]-$3-$1";
print " New Format : $NewFormat ( Month-DD-YY )\n";
}
else {
print "Ooops date in not in YYYY-MM-DD format \n";
}
Thanks
Cornball