Q&A > dates and times > How do I find today's date? contributed by Zombie Melkurion
$tm = localtime;
printf("The current date is %04d-%02d-%02d\n", $tm->year+1900,
printf("The current time is %02d:%02d:%02d\n", $tm->hour, $tm->min, $t
For formatted date/time strings I prefer
use POSIX 'strftime';
print 'The current date is ';
print strftime('%Y-%m-%d', localtime), "\n";
Perl Training in the UK <http://www.iterative-software.com>
By rote learning.
Via Genetic memory.
It's provided by my firmware.
I just remember them.
Thirty days hath September
My computer gets it right, usually.
I just ask someone else.
Someone punches me on the first of the month.
Results (237 votes),