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
ASKED:
January 4, 2011 5:08 PM
UPDATED:
January 4, 2011 7:57 PM
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.
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/sysdummy1The 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