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.
Hi, I need to calculate difference in Start_Date & End_date in output format like 'x Days y Hrs and z Mins'.
The Strat_Date & End_Date have format like HYYMDs.
I am able to find difference for 'x Days and y Hrs' but not for calculating 'Mins'. I am getting mins like 500 ,535 etc. Ideally it should be 20 mins etc(only 2 digits). I am using HDIFF() function for that.
DEFINE FILE CAR
BEGDTA/A20='20080910103000000';
ENDDTA/A20='20080910103500000';
BEGDT/HYYMDS=HINPUT(14,BEGDTA,8,'HYYMDS');
ENDDT/HYYMDS=HINPUT(14,ENDDTA,8,'HYYMDS');
DIFF_MIN/D6=HDIFF(ENDDT,BEGDT,'MINUTE','D6');
END
TABLE FILE CAR
PRINT BEGDTA BEGDT ENDDTA ENDDT DIFF_MIN
BY COUNTRY
END
Your code looks correct. Please check your data. In the sample above, I get 5 minutes which is the answer I was expecting.
DEFINE FILE CAR BEGDTA/A20='20080910103000000'; ENDDTA/A20='20080911135500000'; BEGDT/HYYMDS=HINPUT(14,BEGDTA,8,'HYYMDS'); ENDDT/HYYMDS=HINPUT(14,ENDDTA,8,'HYYMDS'); DIFF_MIN/D6=HDIFF(ENDDT,BEGDT,'MINUTE','D6'); DAYS/D2=INT(DIFF_MIN/1440); HOURS/D2=INT((IMOD(DIFF_MIN, 1440, 'D20.2')/60)); MINS/D2=DIFF_MIN - (DAYS * 1440) - (HOURS * 60); DAYT/A6= IF DAYS EQ 1 THEN ' Day ' ELSE ' Days '; HRT/A7= IF HOURS EQ 1 Then ' Hour ' ELSE ' Hours '; MINT/A8= IF MINS EQ 1 THEN ' Minute ' ELSE ' Minutes'; DIFFERENCE/A30= TRIM('L', EDIT(DAYS), 2, '0', 1, 'A2') | DAYT | TRIM('L', EDIT(HOURS), 2, '0', 1, 'A2') | ' Hours ' | TRIM('L', EDIT(MINS), 2, '0', 1, 'A2') | ' Minutes'; END TABLE FILE CAR PRINT BEGDTA BEGDT ENDDTA ENDDT DIFFERENCE BY COUNTRY END If you want leading zero's just use a plain edit and remove trhe TRIMThis message has been edited. Last edited by: <JG>,