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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Difference b/w dates

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Difference b/w dates
 Login/Join
 
Master
posted
Hai,

I am trying to find 2 dates using today's date.
For example today is Monday, March 8th. I need 2 dates from this today's date which should be prior sunday (2010/02/28) and saturday (2010/03/06). I am able to get saturday's date but when I am trying for prior sunday its giving me 20100298..!! I used normal minus to subtract and DATEDIF function.

This is for a report which runs every monday using those dates as FROM and TO dates.

Can anyone tell me what mistake I am doing?

thanks a lot..

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


8.1.05
HTML,PDF,EXL2K, Active, All
 
Posts: 484 | Registered: February 03, 2009Report This Post
<JG>
posted
Not running on a PS3 by any chance
 
Report This Post
Expert
posted Hide Post
quote:
Not running on a PS3 by any chance

Good One



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
..??!! :-|


8.1.05
HTML,PDF,EXL2K, Active, All
 
Posts: 484 | Registered: February 03, 2009Report This Post
Expert
posted Hide Post
Enigma, can you post your code please? Maybe we can spot something you are missing.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Master
posted Hide Post
-SET &TODAY = 20100308;
-TYPE 20100308
20100308
-SET &DATE_TO = 20100308 - 2;
-TYPE 20100306
20100306
-SET &DATE_FROM = 20100306 - 6;
-TYPE 20100300
20100300
-SET &DATE_FROM1 = 20100306 - 8;
-TYPE 20100298
20100298
-EXIT


8.1.05
HTML,PDF,EXL2K, Active, All
 
Posts: 484 | Registered: February 03, 2009Report This Post
Virtuoso
posted Hide Post
In Dialogue Manager, dates are treated like numbers, not dates. In order to treat numbers as dates, you must use a date function.

-SET &PR_SAT = AYMD(&YYMD,-2,'I8');
-SET &PR_SUN = AYMD(&YYMD,-8,'I8');


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Expert
posted Hide Post
-*-- Dialogue Manager Dates Example --------------------------------------------

-*-SET &INPUT_DATE = '20090317';
-*-SET &INPUT_DATE = &YYMD;
-SET &INPUT_DATE = '20100326';

-*-- Determine friendly dates
-SET &IND = DOWKL(&INPUT_DATE, 'A12') || (', ' | CHGDAT('YYMD', 'MXDYY', &INPUT_DATE, 'A17'));

-*-- Determine Monday (BOW) and Friday (EOW) dates for current date
-SET &BOW1 = DATECVT(DATEMOV(DATECVT(&INPUT_DATE, 'I8YYMD', 'YYMD'), 'BOW'), 'YYMD', 'I8YYMD');
-SET &EOW1 = DATECVT(DATEMOV(DATECVT(&INPUT_DATE, 'I8YYMD', 'YYMD'), 'EOW'), 'YYMD', 'I8YYMD');

-*-- Determine previous Saturday and Sunday dates, v1
-SET &PSA1 = DATECVT(DATEADD(DATECVT(&BOW1, 'I8YYMD', 'YYMD'), 'D', -2), 'YYMD', 'I8YYMD');
-SET &PSU1 = DATECVT(DATEADD(DATECVT(&BOW1, 'I8YYMD', 'YYMD'), 'D', -1), 'YYMD', 'I8YYMD');

-*-- Determine previous Saturday and Sunday dates, v2
-SET &PSA2 = AYMD(&BOW1, -2, 'I8YYMD');
-SET &PSU2 = AYMD(&BOW1, -1, 'I8YYMD');

-*-- Determine previous friendly dates
-SET &PSA3 = DOWKL(&PSA2, 'A12') || (', ' | CHGDAT('YYMD', 'MXDYY', &PSA2, 'A17'));
-SET &PSU3 = DOWKL(&PSU2, 'A12') || (', ' | CHGDAT('YYMD', 'MXDYY', &PSU2, 'A17'));

-*-- Determine next Saturday and Sunday dates, v1
-SET &NSA1 = DATECVT(DATEADD(DATECVT(&EOW1, 'I8YYMD', 'YYMD'), 'D', +1), 'YYMD', 'I8YYMD');
-SET &NSU1 = DATECVT(DATEADD(DATECVT(&EOW1, 'I8YYMD', 'YYMD'), 'D', +2), 'YYMD', 'I8YYMD');

-*-- Determine next Saturday and Sunday dates, v2
-SET &NSA2 = AYMD(&EOW1, +1, 'I8YYMD');
-SET &NSU2 = AYMD(&EOW1, +2, 'I8YYMD');

-*-- Determine next friendly dates
-SET &NSA3 = DOWKL(&NSA2, 'A12') || (', ' | CHGDAT('YYMD', 'MXDYY', &NSA2, 'A17'));
-SET &NSU3 = DOWKL(&NSU2, 'A12') || (', ' | CHGDAT('YYMD', 'MXDYY', &NSU2, 'A17'));

-*-- DISPLAY DATES ---
-TYPE ============================================
-TYPE INPUT DATE: &INPUT_DATE &IND
-TYPE --------------------------------------------
-TYPE PREVIOUS
-TYPE &PSA1 &PSA2 &PSA3
-TYPE &PSU1 &PSU2 &PSU3
-TYPE --------------------------------------------
-TYPE NEXT
-TYPE &NSA1 &NSA2 &NSA3
-TYPE &NSU1 &NSU2 &NSU3
-TYPE ============================================


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
As an alternate solution, you could TABLE into a HOLD file and then -READ values into variables.
Any table with a MFD should work. We use Oracle so example uses DUAL.

DEFINE FILE DUAL
CWS/YYMD WITH DUMMY = DATEMOV('&DATEYYMD','BOW'); -- Using current date, determines first day of the week 20100308
PWS/YYMD = CWS-8; -- Determines the previous Sunday 20100228
END
TABLEF FILE DUAL
PRINT CWS PWS
WHERE READLIMIT EQ 1 -- Limits processing to one read
ON TABLE HOLD FORMAT ALPHA
END
-RUN
-READ HOLD &CWS.A8. &PWS.A8.
-TYPE Result CWS=&CWS PWS+&PWS
Result &CWS=20100308 &PWS=20100228

Hope it helps.


WF 7.6.10 Unix Oracle
 
Posts: 22 | Location: Milano, Italy | Registered: September 16, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Difference b/w dates

Copyright © 1996-2020 Information Builders