Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Creating a string for a date stamp

by danboo (Beadle)
on Sep 20, 2001 at 00:39 UTC ( #113469=note: print w/replies, xml ) Need Help??


in reply to Creating a string for a date stamp

i'd recommend sprintf here:
sub get_time_stamp() { my @tan=Today_and_Now(); my $stamp= sprintf '%d%02d%02d%02d%02d', @tan[0..4]; return $stamp; }
or the brief version:
sub get_time_stamp() { sprintf '%d%02d%02d%02d%02d', (Today_and_Now())[0..4]; }
this will keep all all the potential 1 or 2 digit fields padded with a zero. cheers, - danboo

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-08-10 20:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?