Focal Point
[SOLVED]How to get the previous 6 fridays date and the coming fridays date

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1927093386

August 11, 2016, 02:01 AM
info4pal
[SOLVED]How to get the previous 6 fridays date and the coming fridays date
Hi,

Iam trying to get the previous 6 week's friday's dates based on the current date(i.e.,5th Aug 2016,29th July,22nd July,15th July,8th July,1st July) and also the current week's friday i.e., now it would be 12th Aug 2016 but Iam unable to do so.

Could anyone please let me know how to get this done in this format - (say 1-Jul-16).

Currently Iam using this code below :
-SET &FRIDATE0 =
- DATECVT((DATEMOV((DATECVT(&YYMD,'I8YYMD','YYMD')),'EOW')),'YYMD','I8YYMD');

-*-- Calulate the previous seven Fridays---------------------------------------

-SET &FRIDATE1 = AYMD(&FRIDATE0, -7, 'I8YYMD');
-SET &FRIDATE2 = AYMD(&FRIDATE1, -7, 'I8YYMD');
-SET &FRIDATE3 = AYMD(&FRIDATE2, -7, 'I8YYMD');
-SET &FRIDATE4 = AYMD(&FRIDATE3, -7, 'I8YYMD');
-SET &FRIDATE5 = AYMD(&FRIDATE4, -7, 'I8YYMD');
-SET &FRIDATE6 = AYMD(&FRIDATE5, -7, 'I8YYMD');

-TYPE &FRIDATE0
-TYPE &FRIDATE1
-TYPE &FRIDATE2
-TYPE &FRIDATE3
-TYPE &FRIDATE4
-TYPE &FRIDATE5
-TYPE &FRIDATE6

Any help would be greatly appreciated.

Thanks a lot in advance!

Regards,
IP

This message has been edited. Last edited by: info4pal,


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
August 11, 2016, 05:26 AM
Wep5622
For 1-Jul-16 you need to convert the numeric date to alpha. The manuals tell how.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
August 11, 2016, 09:46 AM
RSquared
Try checking todays Day, Thursday etc., and then add the appropriate number of days, 1 for Thursday 2 for Wednesday etc and use that date for calculations


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
August 16, 2016, 01:41 AM
info4pal
Thanks a lot Wep5622 and RSquared for the solutions.It worked!

Thanks,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML