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 differences

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Date differences
 Login/Join
 
<Kitty P>
posted
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,
Kitty

This message has been edited. Last edited by: Kerry,
 
Report This Post
Expert
posted Hide Post
Kitty,

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.


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
Virtuoso
posted Hide Post
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.

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
<Kitty P>
posted
Neftali,

I've looked at the documentation and can't figure out what command to use (define, compute, where/if) or how to get current date in the first field.
 
Report This Post
Virtuoso
posted Hide Post
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


Hope that helps,

Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
Kitty,

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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Kitty

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, 2006Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
<Kitty P>
posted
Thanks so much for the suggestion on the booklet. I will order it today.
 
Report 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 differences

Copyright © 1996-2020 Information Builders