Hello all, I hope this is not too specific for this list. If so, please let me know if you have suggestions on a better place to seek the answer for this.
In the code below, I am using add_delta_workdays from Date::Calendar to check if yesterday was a business day. My problem is that it seems to work when checking for holidays, but when the script runs on a Saturday or Sunday, it reports that the previous business day was Thursday, and *not* Friday as I'd expect. However, on a Monday, it properly identifies the previous business day as the previous Friday. So I am quite perplexed. If anyone out there has a moment to lend some insight, this script can be easily tested by first running it with the system date set properly as today, and then setting the date to be either Saturday, August 10th or Sunday, August 11th (although it happens with any Saturday or Sunday I've tried). The dates are not printed out in the same precise format, but you'll get the idea. I hesitate to assume this would be a bug in the module since it has been a stable release for so long, so I could really use another opinion. Or if you don't receive the same results, perhaps it could be something in my environment. Thanks!! -Ian ----- #!/usr/bin/perl # use strict; use Date::Calc qw(:all); use Date::Calendar; use Date::Calendar::Profiles qw( $Profiles ); my ($year,$month,$day) = Date::Calc->Today(); # figure out what day yesterday was so we can determine if it matches the previous business day my ($yesteryear,$yestermonth,$yesterday) = Add_Delta_Days($year,$month,$day, -1); # now find out what Date::Calendar says the previous business day is based on the standard US profile my ($cal) = Date::Calendar->new( $Profiles->{'US'} ); my ($prevdate) = $cal->add_delta_workdays($year,$month,$day, -1); print "today is $year-$month-$day \n"; print "yesterday is $yesteryear-$yestermonth-$yesterday \n"; print "the previous business day is $prevdate \n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]