[ABE.pm] Re: business day calculations

Faber Fedor faber at linuxnj.com
Thu Oct 21 15:18:38 CDT 2004


On 21/10/04 15:59 -0400, Faber Fedor wrote:
> On 21/10/04 15:41 -0400, Ricardo SIGNES wrote:
> > Once search.cpan.org is back up, I'll have a look,
> > but I'd wager that there is either a DateTime::* module, or that
> > Date::Calc can easily do it.

the DateTime FAQ (http://datetime.perl.org/faq.html) sez : go to the
last_day_of_month and counts backwards.

  my $dt = DateTime->last_day_of_month( year => 2003, month => 8 );

  # day 6 is Saturday, day 7 is Sunday
  while ( $dt->day_of_week >= 6 ) { $dt->subtract( days => 1 ) }

  print "Payday is ", $dt->ymd, "\n";


It'll do.

-- 
 
Regards,
 
Faber                     

Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com





More information about the ABE-pm mailing list