MLUG: Re: [MLUG] formatting dates in perl
Re: [MLUG] formatting dates in perl
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mike Miller wrote:
> I can do this:
> 
> perl -e
> '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
> print "$mon $mday $year\n";' | awk '{print $1+1"/"$2"/"$3+1900}'
> 
> using awk to format the date properly.  I'll bet I just need to know how
> to write the perl print statement correctly in the first place, then I can
> skip the awk.  Can anyone tell me how?

How about this:

perl -e
'($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
print $mon+1," $mday ",$year+1900,"\n";'

-- MK

<< Terra es et in terram ibis >>
--
To manage your subscription, go to http://mlug.missouri.edu/members/edit.php

Archives are available at http://mlug.missouri.edu/list-archives/