But what does WebFOCUS consider one month equal to? 30 days? Same day, but prior month?
Just curious.This message has been edited. Last edited by: <Kathryn Henning>,
Production - 7.6.4 Sandbox - 7.6.4
October 27, 2014, 01:39 PM
MartinY
It use an internal matrix to reduce (or add) the number of days in a month to go to the previous or the next one without creating an invalid date.
Per example:
DEFINE FILE CAR
MTH1/YYMD=DATEADD('2014/03/31', 'M', -1);
MTH2/YYMD=DATEADD('2014/03/31', 'M', -2);
MTH3/YYMD=DATEADD('2014/03/31', 'M', -3);
MTH4/YYMD=DATEADD('2014/03/25', 'M', -5);
END
TABLE FILE CAR
BY COUNTRY NOPRINT
BY MTH1
BY MTH2
BY MTH3
BY MTH4
WHERE COUNTRY EQ 'FRANCE';
END
-RUN
Was just to show the result of month shift with different input date values. Was easier, I've been lazy But true, the input of DATEADD, must be a smartdate.
DEFINE FILE CAR
DTE/YYMD=&YYMD;
DT_1 /YYMD=DATEADD(DTE, 'M', -1);
END
TABLE FILE CAR
PRINT DTE DT_1
BY COUNTRY
WHERE COUNTRY EQ 'FRANCE';
END
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
October 28, 2014, 07:00 AM
ColdWhiteMilk
ok, so it is not just subtracting 30, for example, which is what I was trying to confirm.
Thank you.
Production - 7.6.4 Sandbox - 7.6.4
October 28, 2014, 07:31 AM
MartinY
And it's smart enough to take care of the leap years as per below example. (I know I used a text date, but it's just to show )
DEFINE FILE CAR
MTH1/YYMD=DATEADD('2012/03/31', 'M', -1);
END
TABLE FILE CAR
BY COUNTRY NOPRINT
BY MTH1
WHERE COUNTRY EQ 'FRANCE';
END
-RUN
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
October 28, 2014, 11:06 AM
susannah
seems to be a theme today. Tom, look up the AYMD and AYM functions, for working with &var dates, adding and subtracting. You'll enjoy knowing about them.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID