Days of the week in AS/400 V5R4

190 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

Answer Wiki

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

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • GHENDER
    I have a program in which I need to compare let's say the 5th Monday of 2011 to the 5th Monday of 2010. As a result, I need the program to tell me what date in 2010 is the 5th Monday.
    190 pointsBadges:
    report
  • TomLiotta
    I don't have such a routine handy, but you might try running a statement like this and studying the result:
    SELECT week(current date),
           week(current date - 1 days),
           week(current date - 3 days),
           week(current date - 8 days),
           week(current date + 8 days) FROM sysibm/sysdummy1
    The WEEK() and WEEK_ISO() functions might be of use in doing such date manipulation. Read the SQL documentation on the functions and make sure that you understand what the definition of a "week number" is. You'll want to be sure that your company's use of a "week number" matches with standards. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following