niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Perl
Problem with Date::Manip
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
Ted Byers
*nix forums beginner


Joined: 22 Dec 2005
Posts: 24

PostPosted: Fri Jul 21, 2006 4:23 am    Post subject: Problem with Date::Manip Reply with quote

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,Cool;

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,Cool;
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

PostPosted: Fri Jul 21, 2006 8:34 am    Post subject: Re: Problem with Date::Manip Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Sun Nov 23, 2008 2:30 pm | All times are GMT
navigation Forum index » Programming » Perl
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Unknown in header problem -SOLVED- Light Speed Postfix 0 Thu Jul 03, 2008 10:40 am
No new posts problem with sending mail nuxia Postfix 0 Mon Apr 21, 2008 3:58 am
No new posts Postfix 2.3.8 Virtual problem Blotto Postfix 0 Fri Apr 04, 2008 6:11 am
No new posts Postfix sending problem for local domain remote email monkey_magix Postfix 0 Mon Sep 10, 2007 10:17 am
No new posts bounce problem murkis Postfix 0 Sun Oct 08, 2006 3:45 pm

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
[ Time: 0.2785s ][ Queries: 16 (0.2023s) ][ GZIP on - Debug on ]