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] Calculate DATEDIF based on a 360 day year

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Calculate DATEDIF based on a 360 day year
 Login/Join
 
Member
posted
Is there a way to calculate the difference between 2 dates in days based on a 360 day year, similar to excel's days360 function?

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


Mainframe FOCUS 7.3.8 10.26.05 18.02
Windows, All Outputs
 
Posts: 1 | Registered: October 13, 2011Report This Post
Gold member
posted Hide Post
David,

Found this on the tech support:

  
[url=http://techsupport.informationbuilders.com/hottrack/70141087.html][/url]


Basically it is saying WF doesn't have such a function; however, there is technique that may help you on that URL.


WF 7.6.10, Windows, PDF, Excel
 
Posts: 75 | Location: Dallas, TX | Registered: February 12, 2004Report This Post
Virtuoso
posted Hide Post
There may be other solutions, but one is to multiply the number of days calculated with DATEDIF by 72/73 (which is the same as the number of minutes in a 360 day year divided by the number of minutes in a 365 day year: 1440 / 1460).

DEFINE FILE CAR
 DATE1/YYMD WITH COUNTRY = '2010/01/01';
 DATE2/YYMD WITH COUNTRY = '2010/02/01';
 DATE3/YYMD WITH COUNTRY = '2011/01/01';
 DATE_DIFF_365M/I5 = DATEDIF(DATE1,DATE2,'D');
 DATE_DIFF_360M/I5 = DATE_DIFF_365M * 72 / 73 ;
 DATE_DIFF_365Y/I5 = DATEDIF(DATE1,DATE3,'D');
 DATE_DIFF_360Y/I5 = DATE_DIFF_365Y * 72 / 73 ;
END
-*
TABLE FILE CAR
 PRINT
  DATE1 DATE2
  DATE_DIFF_365M DATE_DIFF_360M
  DATE1 DATE3
  DATE_DIFF_365Y DATE_DIFF_360Y
 WHERE RECORDLIMIT EQ 1 ;
END

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
Cool! Thanks for that Dan. Good One



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
Virtuoso
posted Hide Post
Actually, it makes more sense to just multiple the result of DATEDIF by 360/365. Don't know why I felt the need to state it in minutes.

 DATEDIF(DATE1,DATE2,'D') * 360 / 365 ;


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
Maybe because time is gold? Wink



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
Virtuoso
posted Hide Post
Just occurred to me that leap years could present a problem. May be best to calculate the number of days in the year and use that number as the divisor for converting to 360 day equivalents.

DEFINE FILE CAR
 YEAR_BEG/YYMD WITH COUNTRY = '2008/01/01';
 YEAR_END/YYMD WITH COUNTRY = '2008/12/31';
 YEAR_DAYS/I5 = DATEDIF(YEAR_BEG,YEAR_END,'D') + 1 ;
 DATE1/YYMD WITH COUNTRY = '2008/02/01';
 DATE2/YYMD WITH COUNTRY = '2008/03/01';
 DATE3/YYMD WITH COUNTRY = '2009/01/01';
 DATE_DIFF_365M/I5 = DATEDIF(DATE1,DATE2,'D');
 DATE_DIFF_360M/I5 = DATE_DIFF_365M * 360 / YEAR_DAYS ;
 DATE_DIFF_365Y/I5 = DATEDIF(YEAR_BEG,DATE3,'D');
 DATE_DIFF_360Y/I5 = DATE_DIFF_365Y * 360 / YEAR_DAYS ;
END
-*
TABLE FILE CAR
 PRINT
  YEAR_BEG YEAR_DAYS
  DATE1 DATE2
  DATE_DIFF_365M DATE_DIFF_360M
  DATE3
  DATE_DIFF_365Y DATE_DIFF_360Y
 WHERE RECORDLIMIT EQ 1 ;
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
quote:
DATEDIF(DATE1,DATE2,'D') * 360 / 365 ;


Could the leap year issue be solved by slightly adjusting your original expression?

DATEDIF(DATE1,DATE2,'D') * 360 / 365.25 ;


Or would that be too simplistic?



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
  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] Calculate DATEDIF based on a 360 day year

Copyright © 1996-2020 Information Builders