Re: Problems getting current time

2005-07-20 Thread Tom Allison
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 Tim

Re: Problems getting current time

2005-07-19 Thread Jay Savage
On 7/19/05, Dave Adams <[EMAIL PROTECTED]> wrote: > You are right. > > I thought it was something more because I got an error: > > Can't locate object method "hours" via package "Time::tm" (perhaps you forgot > to > load "Time::tm"?) at ./GetDate.pl line 4. > > I was also using the Orielly Per

Re: Problems getting current time

2005-07-19 Thread Dave Adams
You are right. I thought it was something more because I got an error: Can't locate object method "hours" via package "Time::tm" (perhaps you forgot to load "Time::tm"?) at ./GetDate.pl line 4. I was also using the Orielly Perl CookBook 2nd Edition and it specifies $hours and not $hour. This

Re: Problems getting current time

2005-07-19 Thread jm
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 +

Re: Problems getting current time

2005-07-19 Thread Wiggins d'Anconia
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); The above should include $tm->hour instead of