Focal Point
DATEDIF, Elapsed Months - Fraction of a month?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5471096961

May 28, 2006, 11:51 AM
S.J. Kadish
DATEDIF, Elapsed Months - Fraction of a month?
FOCUS warriors:

Is there some way to alter this compute so that we can get a fraction of a month:

COMPUTE ELAPSED_MONTH_COUNT/P7.1C = DATEDIF(COMMISSION_DT,MID_MONTH_DT, 'M');

1.) Both of the dates are Smart Dates.
2.) The Mid-Month Date is based on the &YYM | '15'

We need to differentiate at a breaking point of 5.5 months. All of my examples have been like 4.0 months, 5.0 months, etc.

I scoped the entire site and also checked IBI TechResponse so anything you provide will be greatly appreciated.

Thanks for your help.

Happy Trails,
Sandy
May 28, 2006, 09:50 PM
Piipster
DATEDIF returns a whole number not fractions.

I take it the dates you are dealing with could be any day of any month? Not just beginning or end of month.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
May 29, 2006, 09:19 AM
S.J. Kadish
The mid-month date is always XXXX-XX-15. The Commission Date could be anytime in the month.


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
May 29, 2006, 02:15 PM
smiths
Sandy,

Why not get the difference in number of days, then divide by approx 30.4 to get the number of months (with decimal places). Here's an example using the MOVIES file:

DEFINE FILE MOVIES

-* Compare to today's date
TDATE/YYMD = &YYMD;

-* Get days elapsed since release date
DAYSELAP/D5 = DATEDIF(RELDATE, TDATE, 'D');

-* Convert to months elapsed since release date
MONTHSELAP/D8.2 = DAYSELAP / 30.4

END

TABLE FILE MOVIES
PRINT
MOVIECODE
RELDATE
-* TDATE
DAYSELAP
MONTHSELAP
END

Regards,
Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode