Posts

Showing posts from November, 2015

IBI WebFOCUS - Finding prior/future dates from current date

I have come across the situation many a times where we need to filter report data for: 1) 6 months prior to selected/system date. 2) Report should pull data for date greater than last 30 days. 3) Any other situation where you need 30 days prior, 1 year future date, 3 months after date from system date etc. I feel it is worth sharing the below piece of code: -SET &DATEINPUT = EDIT('&DATEYYMD.EVAL','9999$$$$$$')||EDIT('&DATEYYMD.EVAL','$$$$$99$$$')||EDIT('&DATEYYMD.EVAL','$$$$$$$$99'); -TYPE &DATEINPUT -SET &DATE_30 = DATECVT((DATEADD((DATECVT(&DATEINPUT, 'I8YYMD', 'YYMD')), 'D', -30 )), 'YYMD', 'I8YYMD'); -TYPE IN: &DATEINPUT / OUT: &DATE_30 In above example, I calculated date which is 30 days prior to currect date. In place of 'D', we can have 'M', 'Y' and 'BD' for Months, Year and Business days. If you need to calcula