On Fri, Jun 17, 2005 at 04:18:37PM -0700, Wagner, David --- Senior Programmer 
Analyst --- WGO wrote:

> Siegfried Heintze wrote:
> > Given the current date, I want to compute the date of the Sunday
> > before. There are a lot of date packages on CPAN. Can someone
> > recommend one that would be well suited for this calculation?
> > Siegfried
> 
> How do you want to handle Sunday? Is that the previous Sunday or the
> day you run?  I would just roll my own using localtime.  Since the 6th
> item is the day of the week, you can use that calculate the prior
> Sunday.  I have my own little routine which I use in my scripts which
> takes an array reference and a secondary time variable.
> 
> Here is a start( not tested):

Too much work!

$ perl -MDate::Manip -le 'print UnixDate Date_GetPrev("today", "sun"), "%F"'

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to