nabrown737 has asked for the wisdom of the Perl Monks concerning the following question:
I'm currently working with an older version of DateManip and for various reasons I can't upgrade it at the moment. I'm trying to calculate the number of days in the Delta between two dates. I need to be able to calculate this delta in both business and standard days. The issue arises that the code can't seem to convert months into days. Example:
$start = &DateManip::ParseDate('2013-10-03 00:00:00'); $end = &DateManip::ParseDate('2013-12-09 00:00:00'); #Standard Days my $standard_delta = &DateManip::DateCalc($start,$end,1); my $standard_days = &DateManip::Delta_Format($standard_delta,2,'%dt'); print "$standard_days\n"; #Business Days my $business_delta = &DateManip::DateCalc($start,$end,2); my $business_days = &DateManip::Delta_Format($business_delta,2,'%dt'); print "$business_days\n";
So I would expect this to print out the number of standard and business days somewhere in the 60s. Instead it ignores the difference of 2 months and prints out just the difference in days (6 standard days and 4 business days). This seems to be because it doesn't know with certainty how many weeks are in each month and thus can't convert from months to weeks and weeks to days. Any ideas on how I can get it to convert from months to days in both business and standard?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DateManip Delta_Format Usage
by wjw (Priest) on Jan 11, 2014 at 17:52 UTC | |
by SBECK (Chaplain) on Jan 13, 2014 at 18:05 UTC | |
by wjw (Priest) on Jan 13, 2014 at 20:15 UTC | |
by nabrown737 (Initiate) on Jan 13, 2014 at 22:47 UTC | |
by SBECK (Chaplain) on Jan 14, 2014 at 19:02 UTC |