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.
I am a new user to WebFocus. I am in the process of writing a user guide for our clients and need to know how to find the difference between 2 dates. I would like to have this expression: Current date - date-field = difference in days or months.
Can someone please let me in on how to do this?
Thanks, KittyThis message has been edited. Last edited by: Kerry,
If the dates are smartdates, i.e. formats like YYMD or YYM, you simply subtract the dates as you showed in your post. The answer will be in days using the first format and in months with the second. An example:
NUMDAYS/I4=ENDDATE-BEGDATE;
where the two dates are in YYMD format.
There are many posts in the Forum on this topic. Hit the search button and type in date and difference. The posts contain a lot of good information and references.
When it comes to determine the difference between 2 dates, I've personally found the DATEDIF function extremely useful as it allows us to determine the difference not only in days or months but also in years, weekdays or business days.
Take a look at the documentation for some good examples on how to use it.
To get today's date you can use the &YYMD variable.
DATEDIF can be used in DEFINE, COMPUTE or RECAP. It can also be used in Dialog Manager but since this one does not have a DATE data type, you will need to convert your values to a DATE (using DATECVT function) before attempting to use DATEDIF or any other date function in general.
The silly sample code below defines 4 fields:
- A fixed date of December 31, 2009 - The current date (something you need) - The difference in days between those 2 dates - The difference in *whole* months between the first 2 dates
DEFINE FILE CAR
YEAREND_DT/YYMD WITH CAR = 20091231;
TODAY_DT/YYMD WITH CAR = &YYMD;
DIFF_DAYS/I4 = DATEDIF(YEAREND_DT, TODAY_DT, 'D');
DIFF_MTHS/I4 = DATEDIF(YEAREND_DT, TODAY_DT, 'M');
END
TABLE FILE CAR
PRINT
CAR NOPRINT
YEAREND_DT
TODAY_DT
DIFF_DAYS
DIFF_MTHS
WHERE RECORDLIMIT EQ 1
END
You may be interested in joining this "webinar": FOCUS Functions and Dates. After all, how can you write a user guide about WebFOCUS if you're "a new user to WebFocus"?
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
Did you see all the documentation that comes with WebFocus... It is all available in pdf format and we have set this on out internal website...available for the users. Writing a user guide is not very effective in my opinion.
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, 2006
And then there is also this invaluable booklet '(Almost) 1001 ways to work with dates' (title is close enough I guess), which is available in print for only 25 $ from IBI's documentation website. A very good booklet that describes everything you always wantd to know about dates but were afraid to ask ... In my opinion it's actually a must for every webfocus user.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007