Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Date and time for log files

by nimdokk (Vicar)
on Oct 04, 2007 at 17:21 UTC ( [id://642711]=note: print w/replies, xml ) Need Help??


in reply to Date and time for log files

Yet another way to do it might be as follows:
#!/usr/bin/perl use Time::localtime; $log_name=sprintf("my_log.%04d%02d%02d%02d%02d%02d.log", localtime->year()+1900, localtime->mon()+1,localtime->mday(), localtime->hour(), localtime->min(),localtime->sec()); print $log_name . "\n";
Would give you:

my_log.20071004122204.log
update: removed period between date and time to better reflect string from OP.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://642711]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-24 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found