Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Help with DATEDIF
 Login/Join
 
Platinum Member
posted
I need help from WebFOCUS gurus out there. I am trying to get the difference between two dates using DATEDIFF but gett wrong result. Here is the code that I am using.

-SET &XDATE_FRM_YYMM='&DATE_FRM_YY.EVAL'|'&XDATE_FRM_MM.EVAL';
-SET &AYM1 = EDIT(&XDATE_FRM_YYMM,'999999');
-SET &DATE_FROM=AYM(&AYM1,'-1','I6');

-SET &MON_BEG_DATE = EDIT(&DATE_FROM,'999999') | '01';
-
-SET &DATE_TO ='&DATE_TO_YY.EVAL'|'&XDATE_TO_MM.EVAL';
-SET &MON_END_DATE = EDIT(&DATE_TO,'999999') | '31';
-SET &MONTH_DIFF = DATEDIF(&MON_BEG_DATE,&MON_END_DATE,'M');

When my month begining date is 20071001 and end date is 20080131, I am getting the difference as 299.

Thanks.


WF7.1.4 Prod/Test, MRE, self serve, DM
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Virtuoso
posted Hide Post
I would ad some debug lines to your code to evaluate the intermediate results.

Start with

-SET &ECHO=ALL;

then at the end I would do some type commands

If you put in the last line

-SET &MONTH_DIFF=DATEDIF(20071001,20080131,'M');

What is the result? what you expect (4) than this line is ok. And so on.

Did you buy the book "Almost 1001 ...."




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
Hi,
Your problem is that DATEDIF works with FOCUS dates and not with LEGACY dates (which is what one has in Dialog Manager). Try the following:
-SET &MON_BEG_DATE ='200701';
-SET &MON_END_DATE = '200801';
-SET &MONTH_DIFF = YM(&MON_BEG_DATE,&MON_END_DATE,'I3');
-TYPE &MONTH_DIFF &MON_BEG_DATE &MON_END_DATE


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders