Today's Date in Perl in MM/DD/YYYY format -


i'm working on perl program @ work , stuck on (what think is) trivial problem. need build string in format '06/13/2012' (always 10 characters, 0's numbers less 10).

here's have far:

use time::localtime; $tm=localtime; ($day,$month,$year)=($tm->mday,$tm->month,$tm->year); 

you can fast, using 1 posix function. if have bunch of tasks dates, see module datetime.

use posix qw(strftime);  $date = strftime "%m/%d/%y", localtime; print $date; 

Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -