Focal Point
[SOLVED] DATEDIF error

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

May 04, 2011, 10:27 AM
Mark1
[SOLVED] DATEDIF error
When I do this:

DEFINE FILE CAR
NUMDAYS/I10 WITH CAR = DATEDIF('20110501','20110531','WD');
END
TABLE FILE CAR
PRINT NUMDAYS
END

I get 21, but I think I should get 22? But when I do this:

DEFINE FILE CAR
NUMDAYS/I10 WITH CAR = DATEDIF('20110401','20110430','WD');
END
TABLE FILE CAR
PRINT NUMDAYS
END

I get 21, which would be correct. Does anyone know why this function works for April, but not May? Thanks!

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


Windows version 768
May 04, 2011, 10:30 AM
Tom Flynn
In the U.S., we don't work on Memorial Day...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 04, 2011, 10:40 AM
<JG>
Bug perhaps?

Holidays should not count as week days only as business days if you have a holiday file
May 04, 2011, 10:53 AM
Tom Flynn
Good point John.

7.6.8(even numbered, this is a maintenance release) has 5 Hotfixes:

7.6.8 Hotfix info

But, don't see anything on Date Functions...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 04, 2011, 11:01 AM
FrankDutch
What do you get if you change the WD to D?

I think you get 30 for May

not correct? sure...May has 31 days...but you should not start at the 1ste of May but at the last day of April




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

May 04, 2011, 11:59 AM
<JG>
Frank, then why does it work for April.

Actually this is a real bug. Eeker

Pick any month where the 1st starts on a weekend and the answer is -1 day
May 04, 2011, 01:26 PM
Mark1
Yeah, after I posted, I wracked my brain trying to figure it out and realized that when you do datediff, normally you have to put +1 on the end of it (if you want the days of the month). So, if I'm just doing work days, and the last day of the month is a weekend, you don't have to do that... it is inherently done for you. So, in looking at datedif each month from Jan to October of 2011, only April and July are correct b/c they are the only two months that end on Saturday or Sunday. IBI really needs to focus on making functions more user-friendly or at least include this in documentation, IMHO.


Windows version 768
May 05, 2011, 10:30 AM
Mark1
quote:
Originally posted by Tom Flynn:
In the U.S., we don't work on Memorial Day...


If you work for a hospital, you do.


Windows version 768