Has the 5th business day of the month passed???
Has the 5th business day of the month passed???
- Subject: Has the 5th business day of the month passed???
- From: "Bourque, Jason" <email@hidden>
- Date: Wed, 21 Feb 2001 12:07:30 -0500
Hello,
I need to confirm that the fifth business day of the month has passed before
continueing on with a script.
I have done it successfully but I ask is there a better way.
here's my code
--Reference list for comparing days of the week
set businessDayList to {"Mon", "Tue", "Wed", "Thu", "Fri"}
--This variable is used to toggle the printcode update flag
set fifthBusinessDay to false
--This variable is used to count the business days in the month
set businessDayOfMonth to 0
--This variable is used to hold the current date
set currentDate to (current date)
--This variable is used to walk thru the days of the month
--Copy is used instead of set to avoid data sharing between the variables
copy currentDate to todayDate
--Change the day to the first day of the month
set day of todayDate to 1
--This variable is used as the repeat loop counter
set nth to 1
--Repeat until five business days are passed or we reach today date
repeat until businessDayOfMonth is 5 or (day of todayDate) is (day of
currentDate)
--Get the day of today date
set dayOfToday to text 1 thru 3 of (todayDate as string)
--Check if day of today is in the reference list
if dayOfToday is in businessDayList then
--Add a day to the business day counter variable
set businessDayOfMonth to businessDayOfMonth + 1
--Check business day counter has reached five days
if businessDayOfMonth = 5 then
--Toggle the printcode update flag
set fifthBusinessDay to true
end if
end if
--Increase the repeat loop counter by 1
set nth to nth + 1
--Change the day to the to match the counter
set day of todayDate to nth
end repeat
fifthBusinessDay
Thanks,
Jason Bourque
MFS Investment Management