[EMAIL PROTECTED] (Dave Adams) wrote:
> use Time::localtime;
> my $tm = localtime;
> printf("The current date is
> %04d%02d%02d\n",$tm->year+1900,($tm->mon)+1, $tm->mday);
> my $currentdate = ??
> print ($currentdate);
As others mentioned, you need sprintf. But just another hint:
#!/usr/bin/p
Dave Adams wrote:
I want to create a variable, to be used for other stuff, using today's date.
Can anyone help me with the second last line?
sure :)
my $currentdate = '20050721';
You don't explain what you are trying to get as most of us can't read
your mind or have time to extrapolate fr
Huh? What do you want it to be?
On 7/21/05, Dave Adams <[EMAIL PROTECTED]> wrote:
> I want to create a variable, to be used for other stuff, using today's date.
>
> Can anyone help me with the second last line?
>
> use Time::localtime;
> my $tm = localtime;
> printf("The current date is
> %04d%
On Jul 21, Dave Adams said:
I want to create a variable, to be used for other stuff, using today's date.
And what do you want it to look like? The MMDD format you have
printing?
use Time::localtime;
my $tm = localtime;
printf("The current date is
%04d%02d%02d\n",$tm->year+1900,($tm->m
not sure how you would work your version, but here is what i use all
the time, maybe it will be easier for you as well...
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime;
my $am_pm = $hour > 11 ? " PM" : " AM";
$year += 1900;
$mon += 1;
$sec = "0" . $sec if $sec < 10;