Mightyginger
Programmer
Instead of having to lopp through until the month changes is there a quick way to return the last date of the month?
Also, just to ask your guys opinion about the best way of doing this - I'm trying to work out the last payment date and next payment date of a bond. So I know what today is and I know when the bond matures and how many coupons it pays a year.
So at the moment what I do is take year(today) and month(maturity) and day(maturity) to give me that payment date this year and then loop back using a tempdate until tempdate<dateserial(year(today),month(maturity),day(maturity)). From that I then add on the number of month until the next coupon date and do this until nextcoupondate>today so that is the next coupon and the date "i-1" is the last coupon date. Hope thats clear. Do you think this is the "best" i.e. quickest way of doing this or any or suggestions.
Thanks again guys,
Neil.
Also, just to ask your guys opinion about the best way of doing this - I'm trying to work out the last payment date and next payment date of a bond. So I know what today is and I know when the bond matures and how many coupons it pays a year.
So at the moment what I do is take year(today) and month(maturity) and day(maturity) to give me that payment date this year and then loop back using a tempdate until tempdate<dateserial(year(today),month(maturity),day(maturity)). From that I then add on the number of month until the next coupon date and do this until nextcoupondate>today so that is the next coupon and the date "i-1" is the last coupon date. Hope thats clear. Do you think this is the "best" i.e. quickest way of doing this or any or suggestions.
Thanks again guys,
Neil.