Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Answer: How do I find today's date?

by DeadPoet (Scribe)
on Jan 08, 2011 at 18:07 UTC ( #881252=categorized answer: print w/replies, xml ) Need Help??

Q&A > dates and times > How do I find today's date? - Answer 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

Log In?

What's my password?
Create A New User
[atcroft]: Lady_Aleena: I found the L<name|section> syntax, which describes linking to a perl manual page, and L<text|url> to link to a web page. The reason I asked was because I was on looking at a module,
[atcroft]: and it referred to several other modules, but the links went to I found that a bit of a surprise, and it got me wondering if there was a "standard" way to link to other modules in the documentation on CPAN.
[Lady_Aleena]: atcroft. maybe look at raw PODs. There is also L<foo|http://foo. com> and some might be linking directly to meta::cpan.
[Lady_Aleena]: Oops, didn't read the L<text|url> right.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2017-05-27 03:56 GMT
Find Nodes?
    Voting Booth?