Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Answer: How do I find today's date?

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

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

use localtime or Time::localtime
my($day, $month, $year)=(localtime)[3,4,5]; print "$day-".($month+1)."-".($year+1900)."\n"; # or use Time::localtime; $tm=localtime; my ($day,$month,$year)=($tm->mday,$tm->month,$tm->year);
Edited to fix precedence errors in localtime() version as noted by 3dbc

Comment on Answer: How do I find today's date?
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 lurking in the Monastery: (9)
As of 2015-12-01 09:41 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (798 votes), past polls