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;
$min = "0" . $min if $min < 10;
$hour %= ($hour == 12 and $am_pm eq " PM") ? 13 : 12;
$hour = "0" . $hour if $hour < 10;
$mday = "0" . $mday if $mday < 10;
$mon = "0" . $mon if $mon < 10;


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%02d%02d\n",$tm->year+1900,($tm->mon)+1, $tm->mday);
> my $currentdate = ??????
> print ($currentdate);
> 
> 
> HSCH (Hope Someone Can Help)
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
>

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to