Dave Adams wrote:
I can get date but not time.

use Time::localtime;
$tm = localtime;
printf("Current date: %04d-%02d-%02d\n",$tm->year+1900,($tm->mon)+1, $tm->mday);
printf("Current time: %02d:%02d:%02d\n",$tm->hours,$tm->min,$tm->sec);

Any help would be appreciated.
DA


Rather than using Time::localtime I have a small(er) footprint function using the core localtime() function.

from memory:

my @a = localtime();
$a[4]++; $a[5] += 1900;
sprintf "%02d/%02d/%04d %02d:%02d:%02d", @a[2,1,0,4,3,5];

I have a little module of my favorite goodies that I tuck this into.

--
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