Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Calculating next business day (weekends/holidays taken into account)

by grep (Monsignor)
on Jun 24, 2009 at 20:18 UTC ( #774512=note: print w/ replies, xml ) Need Help??


in reply to Calculating next business day (weekends/holidays taken into account)

You need to increment the day by one and check if it's not a holiday/weekend day. But incrementing days gets hairy, so use one of the great date modules from cpan to do it. I use Date::Calc or for an OO module DateTime.

In fact converting you entire script to use DateTime for dates would be a good thing. It'll end up being far more maintainable in the long run, and looking at what you have so far not to much of a change.

grep
One dead unjugged rabbit fish later...


Comment on Re: Calculating next business day (weekends/holidays taken into account)
Re^2: Calculating next business day (weekends/holidays taken into account)
by vxp (Pilgrim) on Jun 24, 2009 at 20:25 UTC

    Unfortunately, I am not allowed to install anything on the box the script will be running from. That includes CPAN modules :/

    This is why I'm jumping through hoops there, with my get_day() sub :)

      Can you install it for your user account that will run the script? Then you can alter the 'lib' search path.

        nope..

        after some discussion in the chatterbox it was determined that the only way to use modules (and still comply with the security policies on that box) is to just copy/paste them into my script. it sucks, but its the only way. :/

        so, keeping that in mind - any ideas for my sub get_next_business_day { } ? :)

      Obligatory link: Yes, even you can use CPAN

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://774512]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2014-09-21 04:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls