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     [SOLVED] Date Calculations..

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Date Calculations..
 Login/Join
 
Member
posted
I'm new to WF and would appreciate any advice on the following:

I need to create two dates, STARTDATE and ENDDATE.

ENDDATE is the last day of the previous month, for today June 30, 2015

STARTDATE is one year previous, for today July 1, 2014.

Thanks in advance.

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


WebFOCUS 8
Windows, All Outputs
 
Posts: 5 | Registered: April 08, 2015Report This Post
Virtuoso
posted Hide Post
Peter,

WF8 has many different date functions one can use to get and manipulate dates for definition in a data description or report request.

Some I've used are CHGDATE(), DATECVT(), DATEADD(), etc.

This link takes you to a great thread on date manipulation done by others on the forums that I've benefited from from time to time:

http://forums.informationbuild...?r=14810094#14810094

Also, go to IBI's website and find the WF8 docs and search for date functions. You'll find bunches of info there as well.


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
 
Posts: 1113 | Location: USA | Registered: January 27, 2015Report This Post
Platinum Member
posted Hide Post
Here's one example to look at ...

-* SET CURRENT DATE
-SET &CUR_YYMD = &YYMD;
-*-SET &CUR_YYMD = 20110901;
-*
-SET &BCM_YYMD = DATECVT(DATEMOV(DATECVT(&CUR_YYMD, 'I8YYMD', 'YYMD'), 'BOM'),'YYMD', 'I8YYMD');
-*
-SET &BEG_YYMD = DATECVT((DATEADD((DATECVT (&BCM_YYMD, 'I8YYMD', 'YYMD')),'M', -12)), 'YYMD','I8YYMD');
-SET &END_YYMD = DATECVT((DATEADD((DATECVT (&BCM_YYMD, 'I8YYMD', 'YYMD')),'D', -1)), 'YYMD','I8YYMD');
-*
-SET &STARTDATE = FPRINT(DATECVT(&BEG_YYMD,'I8YYMD','MDYY'),'MDtrYY','A20');
-SET &ENDDATE = FPRINT(DATECVT(&END_YYMD,'I8YYMD','MDYY'),'MDtrYY','A20');
-*
-TYPE ------------------------------------------------
-TYPE CURRENT DATE (CUR_YYMD) ----- &CUR_YYMD
-TYPE ------------------------------------------------
-TYPE BEGIN CURRENT MONTH (BCM_YYMD) ----- &BCM_YYMD
-TYPE ------------------------------------------------
-TYPE BEGIN DATE (BEG_YYMD) ----- &BEG_YYMD
-TYPE END DATE (END_YYMD) ----- &END_YYMD
-TYPE ------------------------------------------------
-TYPE --- YOUR DATES
-TYPE ------------------------------------------------
-TYPE STARTDATE ----- &STARTDATE
-TYPE ENDDATE ------- &ENDDATE
-TYPE ------------------------------------------------


WebFocus 8.201M, Windows, App Studio
 
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008Report This Post
Virtuoso
posted Hide Post
-SET &CURRENT_YR_MTH   = EDIT(&YYMD,'999999$$');
-SET &REPORT_YR_MTH    = AYM(&CURRENT_YR_MTH,-1,'I6YYM');
-*
-SET &CURRENT_MTH_BEG  = &CURRENT_YR_MTH | '01';
-SET &REPORT_MTH_BEG   = &REPORT_YR_MTH | '01';
-SET &REPORT_MTH_END   = AYMD(&CURRENT_MTH_BEG,-1,'I8');
-*
-SET &REPORT_YEAR      = EDIT(&REPORT_YR_MTH,'9999$$');
-SET &YEAR1_AGO_YR_MTH = AYM(&CURRENT_YR_MTH,-12,'I6YYM');
-SET &YEAR1_AGO_BEG    = &YEAR1_AGO_YR_MTH | '01';
-*
-TYPE &REPORT_YEAR
-TYPE &REPORT_MTH_END
-TYPE &REPORT_MTH_BEG
-TYPE &YEAR1_AGO_BEG


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Expert
posted Hide Post
Hi Peter,

I would suggest that you have a good read of the Functions manual so you know what is available.

V8.1.04 Functions Manual


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Platinum Member
posted Hide Post
Or you can look into this great book.
http://www.aviter.com/keysheet/home/dates-book/


WebFOCUS 7.7.05 (Someday 8)
Windows 7, All Outputs
In Focus since 1983.
 
Posts: 103 | Registered: April 27, 2011Report This Post
Member
posted Hide Post
Thanks all for your assistance. Much appreciated.
 
Posts: 5 | Registered: April 08, 2015Report This Post
Gold member
posted Hide Post
Just for fun, here is how it could be done without subroutines:

  
DEFINE FILE CAR                                                 
TODAY/YYMD WITH COUNTRY = &YYMD ;                               
YRMON/YYM = TODAY ;                                             
FSTDAY/YYMD = YRMON ;                                           
IFSTDAY/I8YYMD = FSTDAY ;                                       
IYR/I4 = IFSTDAY/10000 ;                                        
IMDAY/I4 = IFSTDAY - (IYR*10000);                               
ISTART/I8YYMD = (IYR-1)*10000 + IMDAY ;                         
STRTDAY/YYMD = ISTART ;                                         
ENDDAY/YYMD = FSTDAY - 1;                                       
END                                                             
-RUN                                                            
TABLE FILE CAR                                                  
PRINT YRMON YRMON FSTDAY ENDDAY IFSTDAY IYR IMDAY ISTART STRTDAY
IF RECORDLIMIT EQ 1                                             
END                                                             
-RUN                                                            


IBI Development
 
Posts: 61 | Registered: November 15, 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     [SOLVED] Date Calculations..

Copyright © 1996-2020 Information Builders