John,

Have you looked at the date and time apis? With these apis you can
determine if the current date is the date you want. The basics are as
follows (note: where the apis call for INT4 use an integer of length 10).

1. Use the Convert Date to Lilian Format (CEEDAYS) api to convert the
current date to a lilian date.
2. Subtract the day of the month from the lilian date and add 1 ( (lilian
date - DD) + 1 ) to get the first day of the month.
3. Determine the number of days remaining in the month. Add this to the
lilian date.
4. Spin through the month to determine if the current date is one of the
reporting dates. Use the Calculate Day of Week from Lilian Date (CEEDYWK)
api to determine the day of the week.

Determine day of week is a requested Tuesday - Step 4:

X = 1;
tuesday = 0;
liliandate = firstDayOfTheMonthInLilianFormat;

DoW x <= daysinmonth;

CallP(e) CEEDYWK(liliandate:dayofweek);

if dayofweek = 3; // Tuesday since api uses Sunday as the first day
of the week
tuesday = tuesday + 1;
endif;

if currentdateaslilian = liliandate; // you're at today so stop looking
x = daysinmonth + 1;
endif;

liliandate = liliandate + 1;

x = x + 1;

Enddo;


if tuesday = 2;
runprocess;
endif;

if tuesday = 4;
runprocess;
endif;


Hope this helps.

- Gary


-----Original Message-----

date: Wed, 10 Dec 2008 16:48:31 -0600
from: John McKee <jmmckee@xxxxxxxxxxxxxx>
subject: Week of the month

I have a program that runs weekly on Tuesday. Now, the user wants this
program
run on the second and fourth Tuesdays. I have looked through the v5r4 APIs,
but don't see anything that jumps out as something that can return the week
of
the month. Two possibilities: I have not seen it yet, or it isn't there.

Is there a function that can return the week of the month?

Thanks

John McKee






As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.