I'm having trouble finding the valid "components" to be used with HDIFF. I know that DATEDIF uses WD for weekday but is there an equivalent for HDIFF? I've tried WEEKDAY but it just returns zeros. DAY works correctly, but I need just the week days.This message has been edited. Last edited by: FP Mod Chuck,
Thanks but that isn’t what I’m asking. I want to know what component values can be used with hdiff. I need to know how many week days are between two days.
I have searched and searched before posting. As you can see in the link you gave me it does not state what the component values are for hdiff. I can’t find that in any of my searches and have tried every word I can think of for weekday. Datediff documentation says what the values are for that one. Not sure why this is so hard to find for hdiff.
The "component" parameter is used in other Date Time functions and can be found within the "Using Function / Date-Time Functions" section of the documentation - here.
Click the "Supplying Arguments for Date-Time Functions" link to locate the arguements that can be used.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
January 08, 2018, 04:35 AM
Wep5622
That's one of those cases where there is a lack of hyperlinks in the documentation. If you don't know where to look, the documentation can be a bit frustrating at times.
It also does not help that many of the links in the Index of the online documentation point to non-existent pages... It's all a bit broken as of late.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
January 08, 2018, 09:15 AM
jfr99
Not sure if this will help ... but here is an example using DATEDIF and the two date parameters are HDATE functions that convert your DateTime fields to Smart Date fields ...
DEFINE FILE CAR DATE1/HMDYYS = DT(01/08/2018 08:10:20); DATE2/HMDYYS = DT(01/15/2018 09:20:20); -* D_DIFF/I8 = DATEDIF(HDATE(DATE1, 'YYMD'), HDATE(DATE2, 'YYMD'), 'D'); WD_DIFF/I8 = DATEDIF(HDATE(DATE1, 'YYMD'), HDATE(DATE2, 'YYMD'), 'WD'); END -* TABLE FILE CAR PRINT COUNTRY NOPRINT DATE1 DATE2 D_DIFF WD_DIFF WHERE RECORDLIMIT EQ 1 END
This only returns zeros. (even if I put WEEKDAY in upper case)
WebFOCUS 8.0.09 Windows, All Outputs
January 08, 2018, 09:50 AM
MelissaReed
quote:
Originally posted by jfr99: WD_DIFF/I8 = DATEDIF(HDATE(DATE1, 'YYMD'), HDATE(DATE2, 'YYMD'), 'WD'); END
Thank you for the suggestion, this does work. But I was hoping not to have to manipulate the date/time fields. It should work with HDIFF shouldn't it?
WebFOCUS 8.0.09 Windows, All Outputs
January 08, 2018, 10:40 AM
jfr99
Well ... it doesn't appear to work the same. I'm seeing the same thing you are.
Here's an example ...
DEFINE FILE CAR DATE1/HMDYYS = DT(01/08/2018 08:10:20); DATE2/HMDYYS = DT(01/16/2018 09:20:20); -* D_HDIFF/D12.2 = HDIFF(DATE2, DATE1, 'DAY', 'D12.2'); WD_HDIFF/D12.2 = HDIFF(DATE2, DATE1, 'WEEKDAY', 'D12.2'); -* D_DATEDIF/I8 = DATEDIF(HDATE(DATE1, 'YYMD'), HDATE(DATE2, 'YYMD'), 'D'); WD_DATEDIF/I8 = DATEDIF(HDATE(DATE1, 'YYMD'), HDATE(DATE2, 'YYMD'), 'WD'); END -* TABLE FILE CAR PRINT COUNTRY NOPRINT DATE1 DATE2 D_HDIFF WD_HDIFF D_DATEDIF WD_DATEDIF WHERE RECORDLIMIT EQ 1 END
HDIFF and DATEDIF are different animals ... It looks like DATEDIF was built to handle the counting of only week days(WD) or business days(BD) where I'm not sure HDIFF has that capability.
Maybe someone else can explain this better.
WebFocus 8.201M, Windows, App Studio
January 09, 2018, 06:31 AM
Wep5622
From the documentation of the new simplified DTDIFF function I don't see any support for calculating the difference between two date(time)s in working days. I guess the same applies for HDIFF.
I consider that an omission worth opening a case for.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :