Gossamer Forum
Home : General : Perl Programming :

Re: [Paul] Search and translate functions?

Quote Reply
Re: [Paul] Search and translate functions? In reply to
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
Subject Author Views Date
Thread Search and translate functions? zeshan 7920 Apr 3, 2003, 3:22 PM
Thread Re: [zeshan] Search and translate functions?
Paul 7643 Apr 3, 2003, 3:37 PM
Thread Re: [Paul] Search and translate functions?
zeshan 7627 Apr 3, 2003, 3:40 PM
Post Re: [zeshan] Search and translate functions?
Paul 7561 Apr 3, 2003, 3:50 PM
Thread Re: [zeshan] Search and translate functions?
cornball 7610 Apr 10, 2003, 9:57 AM
Thread Re: [cornball] Search and translate functions?
Paul 7571 Apr 10, 2003, 10:35 AM
Thread Re: [Paul] Search and translate functions?
cornball 7525 Apr 10, 2003, 1:46 PM
Thread Re: [cornball] Search and translate functions?
devinci99 7539 Jun 1, 2003, 2:42 AM
Thread Re: [devinci99] Search and translate functions?
Paul 7512 Jun 1, 2003, 2:44 AM
Thread Post deleted by devinci99
devinci99 7512 Jun 1, 2003, 3:32 AM
Post Re: [devinci99] Search and translate functions?
devinci99 7480 Jun 1, 2003, 3:42 AM