## Days of the week in AS/400 V5R4

220 pts.
Tags:
iseries v5r4
RPG
RPG ILE
RPG IV
RPG/400
RPGLE
I know how to determine the day of the week a date falls on. However, I was wondering if there was an easy way to figure the following information: 02/01/10 was the 5th Monday of year 2010, 01/07/11 is the 1st Friday of 2011, etc.?

Software/Hardware used:
as400 v5r4

Thanks. We'll let you know when a new response is added.

Are you asking for a routine to deterime the n occurnace of a day of the year.
4th Sat, 21st Mon, 17 Tues, … ?
If so, determine day of week for Jan 1st of the requester year.
If day of week does not equal the day of week your looking for (1st is a Tues an you are looking for Fri), add x days to this date. where x is the differential. In the above case it would be 3 (Wed, Thur, Fri).
Now multiple n * 7 and add that number of days to your result date from above.
That would give you what you want.

## Discuss This Question: 2 Replies

Thanks. We'll let you know when a new response is added.