|
According to the DSPLY, the date of the Monday of the Third week of 2004 is 01/12/2004. Is that correct? Search for WEEK_ISO at http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/db2/rbafzmstscale.htm Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin rob@xxxxxxxxx Sent by: midrange-l-bounces@xxxxxxxxxxxx 11/24/2003 11:09 AM Please respond to Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> To Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> cc Fax to Subject Re: How to get the corresponding Monday's Date given a week. Does this work? /DEFINE HSpec /INCLUDE ROUTINES/QRPGLESRC,HSPEC /UNDEFINE HSpec *************************************************************************** * Program: * * * * * * Modification log: * * mm/dd/02 by R.Berendt, CCP Group Dekko Services, LLC * * Created. * * * * Compilation instructions: * * (no special instructions this time.) * * * *************************************************************************** /DEFINE DSpec D MonDate s d D WorkDate s d D WorkDateA s 10a D Week s 5i 0 inz(3) D Year s 4a inz('2004') D WorkDay s 5i 0 D WorkWeek s 5i 0 /UNDEFINE DSpec C/EXEC SQL C+ Set Option C+ Naming = *Sys, C+ Commit = *None, C+ UsrPrf = *User, C+ DynUsrPrf = *User, C+ CloSqlCsr = *EndMod C/END-EXEC /free WorkDateA='01/01/' + Year; WorkDate=%date(WorkDateA:*usa); /end-free C/EXEC SQL C+ Set :WorkDay=DAYOFWEEK_ISO(:WorkDate) C/END-EXEC C/EXEC SQL C+ Set :WorkWeek=WEEK_ISO(:WorkDate) C/END-EXEC // In ISO, Monday = 1. /free If WorkDay<>1; Select; When WorkWeek<3; WorkDate=WorkDate + %Days(1-WorkDay); When WorkWeek>50; WorkDate=WorkDate + %Days(8 - WorkDay); EndSl; EndIf; DoU WorkWeek<51; /end-free C/EXEC SQL C+ Set :WorkWeek=WEEK_ISO(:WorkDate) C/END-EXEC // Read the specs, jan 1 may be in the previous year according to ISO /free If WorkWeek>51; WorkDate=WorkDate + %Days(7); EndIf; EndDo; If WorkWeek<>Week; WorkDate=WorkDate + %days(7 * (Week - WorkWeek)); EndIf; dsply WorkDate; *inLr=*on; Return; /end-free Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin Chandra Sekhar Rath <ChandraRS@xxxxxxxxxxxxxxxxx> Sent by: midrange-l-bounces@xxxxxxxxxxxx 11/24/2003 07:46 AM Please respond to Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> To MIDRANGE-L@xxxxxxxxxxxx cc Fax to Subject How to get the corresponding Monday's Date given a week. Hi Group, In my application the user would be entering the number of the week.I.e if he enters 03 , then i would like to get Monday's date(Any format) for 3rd week of 2003.i.e the current year(What ever is the current year) Thanks in advance. Thanks and regards Chandra Sekhar Rath _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l. _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.