jffusion wrote at Wed, 10 Jul 2002 04:57:25 +0200:

> I'm trying to get my script to recognize the date and time. I thought I had it but I 
>keep getting
> errors all over.
> ...
> sub get_date {
>         ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time);
>         @months =
> ("01","02","03","04","05","06","07","08","09","10","11","12");
>         @digits = split(//,$sec);
>         $size = @digits;
>         if ($size == 1) {
>                 $sec = "0$sec";
>         }
>         @digits = split(//,$min);
>         $size = @digits;
>         if ($size == 1) {
>                 $min = "0$min";
>         }
>         $year=$year+1900;
>         $date = "@months[$mon]/$mday/$year";
> }
> }

Seems like you want to have the current time in a format 
"MM/DD/YYYY"

That's a standard job, done with

use POSIX qw/strftime/;

my $date = strftime( "%m/%d/%Y", localtime() );


Best Wishes,
Janek


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to