Here's the formula:
@lastday
//this part handles leap year Februarys
If Remainder(year(Currentdate),4)=0 and Month(Currentdate)=2 then Date(Year(Currentdate),Month(Currentdate),29)
//handles February if not a leap year
else if month(Currentdate)=2 then Date(Year(Currentdate),Month(Currentdate),28)
//Handles April, June, September and November ... remember the rhyme, 30 days hast September????
else if month(Currentdate) in [4,6,9,11] then Date(Year(Currentdate),Month(Currentdate),30)
//Handles All the rest
else Date(Year(Currentdate),Month(Currentdate),31)
disclaimer.....as a Astronomy minor (a long time ago) I remember that every 400 years, there is a February 30th. I do not remember when the next Feb 30th is, but this formula will not work for that month!!!!! Software Support for Sage Mas90, Macola, Crystal Reports and Goldmine