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

Answer: How do I find today's date?

( #881252=categorized answer: print w/ replies, xml ) Need Help??

Q&A > dates and times > How do I find today's date? contributed by DeadPoet

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

Comment on Answer: How do I find today's date?
Select or Download Code
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2015-01-26 15:07 GMT
Find Nodes?
    Voting Booth?

    My top resolution in 2015 is:

    Results (193 votes), past polls