Focal Point
[SOLVED] Issue with DATEADD?

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

March 31, 2015, 10:05 AM
Doug
[SOLVED] Issue with DATEADD?
Reference: Previous Post

Why doesn't the following work in WebFOCUS 8, it returns "*** &DATEADD6=20150334 ***"?
-SET &DATEIN = 20150328 ;
-*               DATEADD(date, 'component', increment)
-SET &DATEADD6 = DATEADD(&DATEIN, 'D' , 6 ) ;
-TYPE *** &|DATEADD6=&DATEADD6 ***
The AYMD functions works fine.

This message has been edited. Last edited by: <Kathryn Henning>,




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
March 31, 2015, 10:17 AM
Francis Mariani
-SET &DATEIN = '20150328';
-SET &DATEADD6 = DATECVT((DATEADD((DATECVT(&DATEIN, 'I8YYMD', 'YYMD')), 'D', 6)), 'YYMD', 'I8YYMD');
-TYPE IN: &DATEIN / OUT: &DATEADD6

The innermost DATECVT function call converts the string value &DATEIN to a smart date. Then the DATEADD function runs and then the outermost DATECVT function converts the smart date back to a string.

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
March 31, 2015, 11:59 AM
Doug
Thanks Francis, It's all about the Smart Date.
September 25, 2015, 10:56 AM
Doug
This still comes up whenever I get code-tied with the dates...
Yep, I do have the "(Almost) 1001 ways to work with DATES in WebFOCUS" book... And highly recommend that it be added to your library... ~ Doug