I know that. I have to check the period (dates entered by user) must be correct and must be perfectly divisible by the interval given. This is a pre-check for the interest calculation.
If user enters '01/04/2010' and '15/05/2010' as the dates, and interval as 'month' then, there are 15 days left and if the banking product is set to calculate interest for a complete month only, then calculation can result in wrong interest figures. So I have to check if given period is perfectly divisible by the interval or not.
I changed the dates to match my date_style.
test=> select age('05/15/2010'::date ,'04/01/2010'::date) test-> ; age --------------- 1 mon 14 days (1 row)