Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How do I incorporate a timestamp into a file name?

by particle (Vicar)
on Jul 03, 2001 at 00:24 UTC ( [id://93313]=note: print w/replies, xml ) Need Help??


in reply to How do I incorporate a timestamp into a file name?

i prefer
use POSIX; use constant DATETIME => strftime("%Y-%m-%d_%H-%M-%S", localtime);
this returns something like "2001-07-02_15-07-32"

i use this to name temp directories, like

my $tmpdir = $ENV{TMP} . '/' . basename $0 . '.' . DATETIME . '.' . $$
which gives me a uniquely named dir. then my named temp files are more human readable, because i don't need the date/time string in their names.

~Particle

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found