>> I'm getting strange results from a business days calculation with
>> Date::Manip. Everything works as expected if I use a number of days
>> between 1 and 6, but after 6 the resulting date doesn't seem to be
>> based on business days.
>>
>> my $unparsed_date = DateCalc("today","+ 6 days",3);
>> my $date = UnixDate($unparsed_date,"%Y%m%d");
>>
>> returns 20130405. Changing to "+ 7 days" returns 20130404 instead of
>> the expected 20130408. Today is 20130328.
>>
>> Does anyone know why this is happening?
>
>
> What happens if you remove the ',3' from the $unparsed_date calculation?
>
> Cos I am not sure that is an argument in that Date::Calc computation.
The following does work:
my $unparsed_date = DateCalc("today","+ 7 business days");
But I'd rather set the mode explicitly. The documentation says the
following are equivalent:
$date=&DateCalc("today","+ 2 business days",\$err);
$date=&DateCalc("today","+ 2 days",\$err,2);
http://www.fnal.gov/docs/products/perl/pod.new/site_perl/5.005/Date/Manip.html
However, if I change "+ 2 days" to "+ 7 days" in the examples, I get
the following different results respectively:
2013040908:00:00
2013040508:00:00
- Grant
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/