User Control Panel
|
|
|
 |
Advertisements
|
 |
|
|
|
HELP US, HELP YOU!
|
| Author |
Message |
Eumod Newbie

Joined: 05 Nov 2006 Posts: 3
 
|
Posted: Sun Nov 05, 2006 8:54 pm Post subject: Timestamp Array |
|
|
Hey guys,
I am attempting to create a LOG FILE,
so I wanted to stamp the time of this
logs generation. so I used:
my $currentdate = localtime;
then i saved this by:
print LOG "===================\n= ALERT LOG\n===================\nTime : " .
$currentdate . "\nBY : $user\nAlert :\n-------------------\n$msg\n===================\n\n";
The problem with this is:
Time : Time::tm=ARRAY(0x1ec1fd4)
How can i fix this?
thanks |
|
| Back to top |
|
 |
Schmexi Newbie

Joined: 02 Oct 2006 Posts: 7
 
|
Posted: Sun Nov 05, 2006 11:52 pm Post subject: |
|
|
I'm not sure how, but for my stamps I use:
| Code: |
sub Stamp {
my ($d,$t);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon++;
$d = sprintf("%4d-%2.2d-%2.2d",$year,$mon,$mday);
$t = sprintf("%2.2d:%2.2d:%2.2d",$hour,$min,$sec);
return($d,$t);
}
($date, $time) = Stamp;
|
Then you can insert them by using $date and $time. Hope that helped! |
|
| Back to top |
|
 |
mat007 Almost An Agent

Joined: 12 Jan 2004 Posts: 1375
   votes: 2
|
Posted: Tue Nov 07, 2006 11:42 pm Post subject: |
|
|
| Code: | | ($sec, $min, $hour) = localtime(time); |
|
|
| Back to top |
|
 |
mattaustin Sentinel

Joined: 19 Jul 2004 Posts: 556 Location: Los Angeles, CA
  votes: 1
|
Posted: Wed Nov 08, 2006 2:40 am Post subject: |
|
|
use scalar if you want to convert it to a string.
print scalar(localtime); #localtime(time) is implied if no arg is passed _________________ [ matt ] |
|
| Back to top |
|
 |
|
|