I am using perl to access a DB from where I am getting the date in DD-MON-YYYY format. I need to perform 2 operations:
- Convert this format to a MM/DD/YYYY format.
Compare this date with two dates to see if it lies in that time range.
my $chdate = '15-Feb-2013';
sub get_stats {
my %map = ( 'Jan' => '01', 'Feb' => '02', 'Mar' => '03', 'Apr' => '04', 'May' => '05', 'Jun' => '06', 'Jul' => '07', 'Aug' => '08', 'Sep' => '09', 'Oct' => '10', 'Nov' => '11', 'Dec' => '12'); $chdate =~ s/(..)-(...)-(....)/$map{$2}\/$1\/$3/; print "New date: $chdate";
}
How do I perform the (2) operation?
I have an old version of Perl (no Time::Piece module), which I do not have privileges to update :)