Thanks Chas and everyone else.
The solution worked perfect
Bbrecht
On Dec 8, 2007 7:35 AM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> On Dec 7, 2007 6:10 PM, <[EMAIL PROTECTED]> wrote:
> > I'm trying to write a subroutine that returns the full month name, for
> > example January, or February whe
Jo for Groups and Lists wrote:
Can you use Date::Manip ?
$fullMonth = &returnFullmonth($month);
sub returnFullmonth {
use Date::Manip;
return UnixDate("2007/$_/01",'%B');
}
This will handle feb, 02, or 2
No, it won't handle anything.
C:\home>type test.pl
use warnings;
$TZ
Can you use Date::Manip ?
$fullMonth = &returnFullmonth($month);
sub returnFullmonth {
use Date::Manip;
return UnixDate("2007/$_/01",'%B');
}
This will handle feb, 02, or 2 but will not handle february itself - so
you may want to check first that you are indeed passing in 1-2
Well, to go along with the other example(s), here is a way of doing it using
the localtime() function:
use strict;
use warnings;
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek,
$dayOfYear, $daylightSavings) = localtime();
my $monthnum = $month + 1;
my %monthname = (
On Dec 7, 2007 6:10 PM, <[EMAIL PROTECTED]> wrote:
> I'm trying to write a subroutine that returns the full month name, for
> example January, or February when I call the subroutine and pass a
> scalar, for example $m that could have a value in one of the following
> format
>
> 1. three letter for
[EMAIL PROTECTED] schreef:
> I'm trying to write a subroutine that returns the full month name, for
> example January, or February when I call the subroutine and pass a
> scalar, for example $m that could have a value in one of the following
> format
>
> 1. three letter format, for example jan or
I'm also a perl newbie, but couldn't you use a hash? Something like:
%fullMonth = ( jan => January,
feb => February,
mar => March,
etc...);
print "Month: $fullMonth{$month}";
-eric
[EMAIL PROTECTED] wrote:
I'm trying to write a subroutine that r