User Control Panel
Advertisements

HELP US, HELP YOU!

Timestamp Array

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help
View unanswered posts
Author Message
Eumod
Newbie
Newbie


Joined: 05 Nov 2006
Posts: 3


PostPosted: Sun Nov 05, 2006 8:54 pm    Post subject: Timestamp Array Reply with quote

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
Newbie


Joined: 02 Oct 2006
Posts: 7


PostPosted: Sun Nov 05, 2006 11:52 pm    Post subject: Reply with quote

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
Almost An Agent


Joined: 12 Jan 2004
Posts: 1375

Reputation: 15.8Reputation: 15.8
votes: 2

PostPosted: Tue Nov 07, 2006 11:42 pm    Post subject: Reply with quote

Code:
($sec, $min, $hour) = localtime(time);
Back to top
mattaustin
Sentinel
Sentinel


Joined: 19 Jul 2004
Posts: 556
Location: Los Angeles, CA
Reputation: 50.7
votes: 1

PostPosted: Wed Nov 08, 2006 2:40 am    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group