Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How do I find today's date?

by DeadPoet (Scribe)
on Jan 08, 2011 at 18:07 UTC ( [id://881252]=note: print w/replies, xml ) Need Help??


in reply to How do I find today's date?

Example 1:

sub timestamp { return localtime (time); } print '[' . timestamp() . ']: Normal Time Format'. "\n";

Output 1:

[Sat Jan 8 11:59:07 2011]: Normal Time Format

Example 2:

use Time::localtime; sub timestamp { my $t = localtime; return sprintf( "%04d-%02d-%02d_%02d:%02d:%02d", $t->year + 1900, $t->mon + 1, $t->mday, $t->hour, $t->min, $t->sec ); } print '[' . timestamp() . ']: Custom Time Format'. "\n";

Output 2:

[2011-01-08_12:06:05]: Custom Time Format

Log In?
Username:
Password:

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

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

    No recent polls found