DateDifference - Help is badly worded....


Legendary Poster

I have the following snip of code:

if (DateDifference(&lpdsCache->StartDate, &lpdsCache->EndDate) > 0)
Do A Whole Bunch of Stuff

- lpdsCache->StartDate is 1/1/2015
- lpdsCache->EndDate is 12/31/2015

Is the Result a Positive or a Negative Number?

I looked at the .CHM - and defines the values as

Return Value Description

0 - Days are the same
Negative number - End date is earlier than start date
Positive number - End date is later than start date

But, my fried brain doesn't compute what an 'Earlier Date' vs a 'Later Date' really is... It just seems to be worded all wonkie! If they had just drawn a picture, maybe even used numbers - ... ugh....

I think it's time I put down the debugger and go xbox something...



Legendary Poster

... my fried brain doesn't compute ...(db)

Poor Dan! Your brain must be beyond fried! I really do think you need a long, long holiday. Or maybe just some sleep. I don't think a few Xbox hours will help.

Its not that complicated.

If the returned number is zero the end date and start date are the same. I think you got this.

If the end date occurs BEFORE the start date (this is weird, who ever heard of the end happening before the beginning, but is within the help description) then the number returned is negative.

If the end date occurs AFTER the start date (this is sensible) then the number returned is positive.

If it helps (and it may not) think of the JDE Julian Date representations:

Start Date is 31st January 2015, which is 115031 in JDE Julian Date speak.

If the End date is 1st January 2015, which is 115001 in JDE Julian Date speak, then 115001 minus 115031 is negative 30. End date is before start date; 1st January 2015 is before 31st January 2015.

If the End date is 28th February 2015, which is 115059 in JDE Julian Date speak, then 115059 minus 115031 is positive 28. End date is after start date; 28th February 2015 is after 31st January 2015.
Last edited:


Legendary Poster
Thanks, Peter!

They never should have used the "Start Date" / "End Date" wording. It should have been "Date1" and "Date2"...

DateDifference(Date1, Date2) is computed as:
(Date2 - Date1) = Difference

They, really, shouldn't allow technical writers to create help manuals.