RE: Has the 5th business day of the month passed???
RE: Has the 5th business day of the month passed???
- Subject: RE: Has the 5th business day of the month passed???
- From: "Bourque, Jason" <email@hidden>
- Date: Thu, 22 Feb 2001 10:29:35 -0500
Hello, thank you for your suggestions and the code that resulted. Here is
what I now intend to use. I think of anything that will improve it let me
know.
Thanks Again.
--Holidays
(*
New Years Day Monday, January 1
Martin Luther King Jr. Day Monday, January 15
Presidents Day Monday, February 19
Good Friday Friday, April 13
Memorial Day Monday, May 28
Independence Day Wednesday, July 4
Labor Day Monday, September 3
Thanksgiving Thursday, November 22
Christmas Tuesday, December 25
*)
--Half Staff Holidays
(*
Patriots Day* Monday, April 16
Columbus Day Monday, October 8
Veterans Day Monday, November 12
Day after Thanksgiving Friday, November 23
*)
--Create a list of Holidays that we will avoid later
set holidayList to {,
date "Monday, January 1, 2001 12:00:00 AM", ,
date "Monday, January 15, 2001 12:00:00 AM", ,
date "Monday, February 19, 2001 12:00:00 AM", ,
date "Friday, April 13, 2001 12:00:00 AM", ,
date "Monday, May 28, 2001 12:00:00 AM", ,
date "Wednesday, July 4, 2001 12:00:00 AM", ,
date "Friday, August 3, 2001 12:00:00 AM", ,
date "Thursday, November 22, 2001 12:00:00 AM", ,
date "Tuesday, December 25, 2001 12:00:00 AM", ,
date "Monday, April 16, 2001 12:00:00 AM", ,
date "Monday, October 8, 2001 12:00:00 AM", ,
date "Monday, November 12, 2001 12:00:00 AM", ,
date "Friday, November 23, 2001 12:00:00 AM"}
--This variable is used to hold the current date
set dateToday to (current date)
--Change the time to midnight for comparison
set time of dateToday to 0
--Variable Check Point
dateToday
--Reference list for comparing days of the week
set businessDayList to {Monday, Tuesday, Wednesday, Thursday, Friday}
--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 keep track of what today is
set todaysDay to (day of dateToday)
repeat with nth from todaysDay to 1 by -1
--Variable Check Point
nth
--Change the day to the to match the counter
set day of dateToday to nth
--Variable Check Point
dateToday
--Check if day of today is in the reference list
if weekday of dateToday
holidayList 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
--This saves few repeat loops by leaving the repeat loop
exit repeat
end if
end if
end repeat
--Variable Check Point
fifthBusinessDay
Jason Bourque
AppleScript Developer
MFS Investment Management