Next Business Day

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Next Business Day

Post by pgriffin » Tue Jul 05, 2005 6:52 pm

I need to be able to determine the date of the next "non-weekend" day during the execution of a script.

so, I'm thinking a VB routine. pass it a variable with the date, VB adds converts it to julian, adds one, then determines the DayName or the numeric day of week (1 - 7), and passes this back to MSched.

Anyone done this?

SkunkWorks

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Jul 05, 2005 7:26 pm

I did something similar a while ago. I spent a lot of time on the Julian thing before realizing it was overkill if you are just dealing with the current day.

If you get Dayofweek> then there are only 3 possible cases for incrementing the current date to get to work day and a series of If>'s will handle it.

If the day is 1 through 5 then add 1 day
If the day is 6 add 3 days
If the day is 7 add 2 days

If you need non-current dates then your approach sounds OK.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts