Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Date and time for log files

by nimdokk (Vicar)
on Oct 04, 2007 at 17:21 UTC ( #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.


Comment on Re: Date and time for log files
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2015-07-07 07:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls