Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Business Days...
#9
Messed with some code today. It works, its a bit clunky and I need to incorporate it into the IsHoliday macro to populate the ini file.
Here's what I got so far:

Function US_Holiday
Code:
Copy      Help
function [YearDate]

;Example:
;US_Holiday 1999

;Outputs:
;1/1/1999
;1/18/1999
;2/15/1999
;5/31/1999
;9/6/1999
;10/11/1999
;11/11/1999
;11/25/1999

;Just US_Holiday on it's own will output US holidays for the current year


if YearDate=0
,_s.time("yyyy")
,YearDate=val(_s)
_s.format("01/01/%i" YearDate)
DATE d=_s
DATE d2
int i=1
int Month=1
SYSTEMTIME st st1
d.tosystemtime(st)
int Year=st.wYear
int yCounter wCounter
for yCounter 0 48 1
,;Run
,for wCounter 0 7 1
,,d.tosystemtime(st)
,,int month=st.wMonth
,,str Fixed.format("%i/%i" st.wMonth st.wDay)
,,if(month>Month) Month+1;i=1;goto Run
,,_s.format("%i:%i:%i" st.wMonth st.wDayOfWeek i)
,,sel(_s)case ["1:1:3","2:1:3","9:1:1","10:1:2","11:4:4"] ;out d
,,sel(_s)case "5:1:4" d2=d;case "5:1:5" d2=d;case "6:1:1";out d2
,,sel(Fixed)case ["1/1","7/4","11/11","12/25"]
,,,sel(st.wDayOfWeek)case 0 d2=d-1;case 6 d2=d+1;case [1,2,3,4,5] d2=d;out d2
,,d=d+1
,i+1

Thanks again for all your help!!
Jimmy Vig


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)