T
Ted
I know the documentation for this module says the author should be
contacted in case a problem is encountered, but I want to know if my
expectations are the problem or the way I am using it before I trouble
such a busy person.
The situation ought to be rather simple, and I thought Date::Manip was
an obvious choice.
The version of Perl that I am using is given by Perl itself:
C:\>perl -v
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 25 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 817 [257965] provided by ActiveState
http://www.ActiveState.com
Built Mar 20 2006 17:54:25
....
The portion of the documentation dealing with Date::Manip that guided
my effort is the following:
"It even works with business days:
$date = DateCalc("today","+ 3 business days",\$err);"
Here is my little test script:
use Date::Manip;
my $day = '20060720';
my $delta = -1;
my $calc_date = substr(DateCalc($day,ParseDateDelta("$delta business
days")),0,8);
print "day = $day\ndelta = $delta business days\ncalculated date =
$calc_date\n\n";
for ($i = 1 ; $i < 60 ; $i++ ) {
$delta = -$i;
$calc_date = substr(DateCalc($day,ParseDateDelta("$delta business
days")),0,8);
print "i = $i\nday = $day\ndelta = $delta business days\ncalculated
date = $calc_date\n\n";
}
I expected this to give me the dates of the $i business days prior to
2006-07-20; i.e. including days Monday through Friday, and excepting
Saturdays and Sundays and holidays (a holiday isn't a business day).
Instead I got every week day going back two months.
I thought maybe Perl needs to be told which days are week days and
which days are holidays. After all, in some places, businesses operate
seven days a week, and there are a number of holidays that are
different between Canada and the US, and the differences seem greater
as the distance gets greater. It makes sense that this should be
configurable, but I did not find information regarding how to configure
that.
Where I want to get to is a situation in which, if I give a date of a
Monday, such as 2006-07-17, I get the date of the previous Friday, if
the weekend was not a long weekend, or the previous Thursday, if the
Friday is a holiday like Good Friday.
Have I misunderstood what the functions from Date::Manip should do for
me, or how they ought to be used? Or is there a configuration issue I
need to address?
Thanks for your time.
Ted
contacted in case a problem is encountered, but I want to know if my
expectations are the problem or the way I am using it before I trouble
such a busy person.
The situation ought to be rather simple, and I thought Date::Manip was
an obvious choice.
The version of Perl that I am using is given by Perl itself:
C:\>perl -v
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 25 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 817 [257965] provided by ActiveState
http://www.ActiveState.com
Built Mar 20 2006 17:54:25
....
The portion of the documentation dealing with Date::Manip that guided
my effort is the following:
"It even works with business days:
$date = DateCalc("today","+ 3 business days",\$err);"
Here is my little test script:
use Date::Manip;
my $day = '20060720';
my $delta = -1;
my $calc_date = substr(DateCalc($day,ParseDateDelta("$delta business
days")),0,8);
print "day = $day\ndelta = $delta business days\ncalculated date =
$calc_date\n\n";
for ($i = 1 ; $i < 60 ; $i++ ) {
$delta = -$i;
$calc_date = substr(DateCalc($day,ParseDateDelta("$delta business
days")),0,8);
print "i = $i\nday = $day\ndelta = $delta business days\ncalculated
date = $calc_date\n\n";
}
I expected this to give me the dates of the $i business days prior to
2006-07-20; i.e. including days Monday through Friday, and excepting
Saturdays and Sundays and holidays (a holiday isn't a business day).
Instead I got every week day going back two months.
I thought maybe Perl needs to be told which days are week days and
which days are holidays. After all, in some places, businesses operate
seven days a week, and there are a number of holidays that are
different between Canada and the US, and the differences seem greater
as the distance gets greater. It makes sense that this should be
configurable, but I did not find information regarding how to configure
that.
Where I want to get to is a situation in which, if I give a date of a
Monday, such as 2006-07-17, I get the date of the previous Friday, if
the weekend was not a long weekend, or the previous Thursday, if the
Friday is a holiday like Good Friday.
Have I misunderstood what the functions from Date::Manip should do for
me, or how they ought to be used? Or is there a configuration issue I
need to address?
Thanks for your time.
Ted