Days between dates in World Writer

Jim_rubino

Reputable Poster
I am trying to find a way to calc the number of days between two dates
within a World Writer in World Software.
I can do this in an AS/400 Query, but cannot seem to get it to work in a
World Writer by just subtracting the two dates. The problem comes in when
the dates are in different years.

Thank you,

Jim Rubino
Senior Programmer Analyst
FIKE CORPORATION (r)
704 South 10th Street
Blue Springs, Mo. 64015
Direct Dial - (816) 655-4579
Or - (816) 229-6216 Ext. 1079
 
There is a paper in KG that addresses this issue. Try WST-99-0210 (a bit=20
clumsy, but appears to work).
My question - how about *TODAY ? - does anyone know if this new param=20
make this task (multiple years) easier to do?




Jim=5Frubino <[email protected]>=20
Sent by: [email protected]
04/21/2004 03:58 PM
Please respond to
[email protected]


To
[email protected]
cc

Subject
Days between dates in World Writer






I am trying to find a way to calc the number of days between two dates
within a World Writer in World Software.
I can do this in an AS/400 Query, but cannot seem to get it to work in a
World Writer by just subtracting the two dates. The problem comes in when
the dates are in different years.
Thank you,
Jim Rubino
Senior Programmer Analyst
FIKE CORPORATION (r)
704 South 10th Street
Blue Springs, Mo. 64015
Direct Dial - (816) 655-4579
Or - (816) 229-6216 Ext. 1079
--------------------------
To view this thread, visit the JDEList forum at:=20
http://www.jdelist.com/ubb/showflat.php?Cat=3D&Board=3DW&Number=3D71302

This is the JDELIST World* Mailing List. To stop receiving these messages, =

login to http://www.jdelist.com/forums, click Control Panel, then click=20
Edit by "Subscribe / Unsubscribe from receiving board posts by email,=20
change message notifications, etc." and adjust your subscription=20
preferences. JDEList is not affiliated with JDEdwards=AE
 
WorldWriters are unfortunately braindead. We have created a set of calculations to get the difference between 2 dates in a WW. I'll see if I can get them into this tiny posting box:

1.

Result . . CYEARDIFF yeardiff 10 0

Expression:

((integer(sddrqj)/1000) - (integer(ondtej)/1000)) * 365.25


2.

Size
Result . . CSHIPD days to ship 10 0

Expression:

sddrqj - (integer(sddrqj/1000) * 1000)

3.
Result . . CTODAY days today 10 0

Expression:

ondtej - (integer(ondtej/1000) * 1000)

4.

Result . . CTOTD totdays 10 0

Expression:

cyeardiff + cshipd - ctoday

This particular calc is to figure out the number of days between today and the ship date. Your need may differ but the concept should work. Tne key is the calc to figure out the if there are 2 years involved.

And it shouldn't have to be this complicated. Hope this helps.
 
I recall this topic coming up on the list many times as well. I remember there were a couple different ways to complete but alas, none "simple". Check the archives as well and you might find the thread(s).
 
I originally responded about 14 hours ago to your first post under the subject "RE:RE:Info on World". It still hasn't surfaced on the list - must be because we are all upside down here and have yet to find a replacement for the carrier pigeon. Then again the time difference doesn't help - the list moderators are probably just making coffee (like you might be doing be right now).

This what I wrote.

Hi Jim,

There are some posts on this list from way back that cover this topic. Please let me know how it all works out for you.

Here is a copy of what I contributed 19 March 2001:-

Hi all,

Recently two subscribers to the list, DKAZINSKI and SCOTT PARKER contributed a formula for calculation of elapsed days between two Julian dates in different years, using WorldWriter.

I used this formula in an AS/400 Query and found that it yielded incorrect
results. The final step was (depending on the desired result):-

Y1 * 365 + D1 - Y2 * 365 - D2 (this is the dkazinski version)

Y2 * 365 + D2 - Y1 * 365 - D1 (this the Scott Parker version)

The correct calculation for Query/400 should be:-

Y1 * 365 + D1 - Y2 * 365 + D2

or Y2 * 365 + D2 - Y1 * 365 + D1

Note the last step should be "plus" not "minus".

Note also that for financial calculations this formula doesn't seem to allow for leap years. It is fine for what we want. We are comparing supplier invoice dates against receipt and order dates so one day every leap year makes no real difference.

The Y1/Y2 and D1/D2 are based on breaking the date into two sub fields in Query or WorldWriter using calcs (INTEGER, SUBSTR or DIGITS or something like that).

I still have no idea why the calc has to be different in Query versus World. At the time the pressure was on to get a workable result - this done other pressures were waiting so I never got back to finding the root cause of the difference.

See also my post copied below. Search using “Parker” and find the entry dated 16 February 2001. There is also an entry on same date from DKazinzki.

It is worthwhile noting that there was a bit of chatter in this forum on date conversion and days between two dates in WW and Query during January - March 2001. Use the search function with "Date" AND "Calculation" to find most of the postings.
 
Back
Top