Friday, 6 January 2012

Last Month End Formula

The formula below will return the last month end date in a formula that you create in a crystal report.
It is very handy as it is dynamic so will save a lot of time.

NumberVar Days:= 1;
NumberVar Month1:= if month(currentdate) = 1 then 12 else month(currentdate)-1;
NumberVar Year1:= if month(currentdate)=1 then year(currentdate)-1 else year(currentdate);
date(year1,month1,days)

No comments:

Post a Comment