Arrgghh!! you just hit on a section I forgot to document while I was
there...
MPEX's %CALENDAR command displays, amongst other things, "holiday"
information. What IS documented is that the display of "holidays" is
controlled by a series of "HOLID##" files in the DATA group of the VESOFT
account, what ISN'T documented is what to put in those files.
Briefly, here are the default files:
H:[TOM]/EMERSON/WORK>PRINT [log in to unmask]
-----Printing HOLID01.DATA.VESOFT
3/MON=Martin Luther King, Jr.'s Birthday
-----Printing HOLID02.DATA.VESOFT
3/MON=Presidents' Day
-----Printing HOLID05.DATA.VESOFT
2/SUN=Mother's Day
LAST/MON=Memorial Day
-----Printing HOLID06.DATA.VESOFT
3/SUN=Father's Day
-----Printing HOLID09.DATA.VESOFT
1/MON=Labor Day
-----Printing HOLID10.DATA.VESOFT
2/MON=Columbus Day (some states)
-----Printing HOLID11.DATA.VESOFT
11=Veterans Day
4/THU=Thanksgiving
As you can see, the format of each file is pretty straight forward:
<WHEN> = <Holiday>
So, "1/SUN=Begin DAYLIGHT SAVINGS" and "LAST/SUN=End DAYLIGHT SAVINGS" in
the appropriate HOLIDnn files will, at the very least, display these
dates on the calendar. Also, it should be equally obvious that this file
isn't limited to just "holidays" -- other notifications or reminders can
be put in these files, such as "1/MON=Timesheets due",
"LAST/FRI=Inventory count for this quarter", or "LAST/SAT=Company
Picnic".
Buried in the MPEX Expression program that displays the calendar is a
routine to calculate the "n'th" day of the month as follows:
DAY1+(N-1)*7+(DAYOFWEEK+7-DATEDAYOFWEEK(DAY1)) MOD 7
where "day1" = the first day of the month you are working with,
"dayofweek" = the day you are looking for, with sun=1, mon=2, ...
sat=7
"n" = the "n'th" day you are looking for (first, second, etc.)
Therefore, the first sunday in April this year would be calculated as
follows:
4/1/96+(1-1)*7+(1+7-DATEDAYOFWEEK(4/1/96)) MOD 7
(day1) (n-1) (sun) (day1)
To find the "last" sunday of October, the procedure is altered slightly
by first calculating the FIRST sunday of November, then simply
subtracting 7 from the result, or:
(11/1/96+(1-1)*7+(1+7-DATEDAYOFWEEK(11/1/96)) MOD 7) - 7
(day1) (n-1) (sun) (day1)
(obviously, this can be simplified for these specific cases as "(n-1)*7"
reduces to zero)
Tom "still documenting after all these years" Emerson
----------
From: Patrick Anderson[SMTP:internet!IX.NETCOM.COM!shatzi]
Sent: Monday, October 28, 1996 8:10 AM
To: internet!RAVEN.UTC.EDU!HP3000-L; TomE
Subject: calculating dates
Now that DST time is over, I am trying to establish a way to calculate
whether it's the first Sunday in April, or the last Sunday in October.
I have the full suite of VESOFT tools, and I want a date expression
where I can schedule changing the clock on the system. any
suggestions?
TIA
(Alternatively, you could move to Arizona where they don't apply DST :)
|