this is what i use to get date/time; something different that may be of benefit

############################
use POSIX 'strftime';

sub timestamp
{
        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;
        
        return("$year-$mon-$mday $hour:$min:$sec $am_pm");
}       # end of        sub timestamp
#############################


On 7/19/05, Dave Adams <[EMAIL PROTECTED]> 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
> 
> --
> 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