Eben:
How many days do you consider a month ?
Otherwise,
Take the julian of each, and subtract the two julians, giving number of
days,
Divide the number of days by either 365 or 366 depending upon leap year
considerations, giving number of years,
Multiply the decimal value by the number of years to give the number of
remaining days,
Divide the number of remaining days by either 28, 29, 30 or 31 depending
on the value of a month, giving # of months,
Multiply the decimal value by either 28, 29, 30 or 31 depending on the
divided number, giving the number of days.
Now, you just need to write the code...
Olav.
Eben Yong wrote:
>I'm slightly embarrassed to even post this question, as I feel I should be
>able to produce this code in a snap, but for some reason my brain must be
>somewhat tired today. In any event, excuses aside, here is the question:
>
>Would someone pls share their COBOL code that will calculate the
>difference between two given dates, and return the results in terms of
>years, months, and days?
>
>For example, the difference between 20060125 and 20040611 is 1 year 7
>months and 14 days.
>
>Care to share?
>Thanks as always,
>Eben Yong
>Health Plan of San Mateo
>
>* To join/leave the list, search archives, change list settings, *
>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
>
>
>
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|