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]
On Sun, 1 Apr 2001, Mikhail Kovalenko wrote:

> > For example, to write a date for 39 days in the future, you can write
> > this:
> >
> > perl -le 'print "" . localtime(time+60*60*24*39)'
> >
> > That works great, but now I want a date in mm/dd/yy or mm/dd/yyyy format.
> > Does anyone know a good way to do that correctly?
>
> Get /bin/date from sh-utils-2.0 instead.
>
[snip]
>
> So your date in mm/dd/yyyy format becomes
>
> $ date -d '39 days' +'%x'
> 05/10/2001


I still would like to know how to do it correctly in perl, if anyone
cares to blurt out the answer.  I know that for a perl maven it would be
very simple to modify my long perl/awk thingy to do it right.

But, I just realized that I *do* have the date program hidden away in an
old powertools directory.  (I'm using Solaris and thought I only had their
[much less impressive] date command.)  So I can use Mikhail's recommended
date command now.

Thanks, Mikhail.

Mike

--
To manage your subscription, go to http://mlug.missouri.edu/members/edit.php

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