hi all,
Am having two i/p columns which consists of date field. Am in need to take the difference between these two columns and i got to change into number of months. Is there any function to implement the same? Or shall i take the difference between the two by using iconv function and then divide it by 30?
Your time will be highly appreciated.
Thanks in advance
veera...
Regarding number of months
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The second approach would not be accurate. On the other hand, there's nothing out of the box that satisfies the requirement. Therefore I recommend that you create a routine that decomposes the dates into year, month and day components and performs the correct arithmetic.
That way you can satisfy your business rule about the result - do you need completed months, a figure rounded to the nearest number of months, fractional months are permitted...
Take some time to design test data for the routine. For each pair of dates determine the expected result and compare this against actual.
That way you can satisfy your business rule about the result - do you need completed months, a figure rounded to the nearest number of months, fractional months are permitted...
Take some time to design test data for the routine. For each pair of dates determine the expected result and compare this against actual.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.