|
|
|
|
|
|
| Author |
Message |
Ted Byers *nix forums beginner
Joined: 22 Dec 2005
Posts: 24
|
Posted: Fri Jul 21, 2006 4:23 am Post subject:
Problem with Date::Manip
|
|
|
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, ;
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, ;
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 |
|
| Back to top |
|
 |
usenet@DavidFilmer.com *nix forums Guru
Joined: 25 Jul 2005
Posts: 545
|
Posted: Fri Jul 21, 2006 8:34 am Post subject:
Re: Problem with Date::Manip
|
|
|
Ted wrote:
| Quote: | I expected this to give me the dates of the $i business days prior to
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.
|
Really??? What goofy version of Date::Manip do you have that you
perldocs for the module do not include the major sub-heading "Holiday
Section"?
Maybe you want to read up on http://tinyurl.com/g99gj
--
David Filmer (http://DavidFilmer.com) |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Sun Nov 23, 2008 2:30 pm | All times are GMT
|
|
Loans | Personal Loans | Loans | Blog5 Game Cheats | Hosting
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|